How to get rid of special character/mysql_escape_string???
Posted: Mon Jun 10, 2002 11:10 am
I am a newbie and I am working with PHP 4.1.2/Mysql/Apache on MacOSX.
If a text has special characters such as an apostrophe i get an error message as soon as I want to write the text via a form into my database. I now found out that one can escape these problems by using the addslashes or the mysql_escape_string functions. I tried it, but I was not succesful and I do not exactly know where to put the function into my code. It definetly does not work this way:
$query = "INSERT INTO news_01(Headline, copy, Author, Publication, Releasedate) VALUES(mysql_escape_string('$Headline', '$copy', '$Author', '$Publication', '$Releasedate')";
Can anybody help?
If a text has special characters such as an apostrophe i get an error message as soon as I want to write the text via a form into my database. I now found out that one can escape these problems by using the addslashes or the mysql_escape_string functions. I tried it, but I was not succesful and I do not exactly know where to put the function into my code. It definetly does not work this way:
$query = "INSERT INTO news_01(Headline, copy, Author, Publication, Releasedate) VALUES(mysql_escape_string('$Headline', '$copy', '$Author', '$Publication', '$Releasedate')";
Can anybody help?