August 27th, 2000, 02:24 AM
I have a form (like this one im typing in now) that lets users submit info into the database. I want it to let them submit apostrophes and other characters that mysql converts, or php converts before putting them in the database. It makes it print out like /'. How can i make it just accept and apostrophe, and print it out normally.
August 27th, 2000, 11:08 PM
If you are using PHP to insert into the MySQL db, you can use the addslashes() function.
Here is a simple example : (the submitted form fields here are "task" and "project")
$esc_task = addslashes($task);
$esc_project = addslashes($project);
$sql = "INSERT INTO archives (taskname,projectname) VALUES ('$esc_task','$esc_project')";
$result = mysql_query($sql);
[This message has been edited by bean_bag (edited August 27, 2000).]