Page 1 of 1

apostrophe problem

Posted: Mon Jan 23, 2006 4:31 pm
by dru_nasty
I've seen fixes when using mysql through a command line but I'm not sure how to tweak my php code to work.

I've got a form, when filled out with and apostrophe like don't, will not pass into my db. I don't want to have to add backslashes each time I enter an apostrophe, so how can I fix this?

Here's the sql statement.

Code: Select all

$sql ="INSERT INTO `testTable` values ('', '$_POST[headline]','$_POST[content]')";

if (mysql_query($sql,$conn)){
echo "records added!";
}else{
echo "something went wrong";
}
How can I fix this?

Posted: Mon Jan 23, 2006 4:50 pm
by Chris Corbyn