PDA

View Full Version : Single Quotes error in mysql 4.1.12


swatisonee
02-07-2006, 09:17 AM
Hi,

My host recently upgraded from 3.23.53 to 4.1.12 of Mysql. Ever since then, any text fields that have an apostrophe or single quote causes this error. If we remove it, the sql processes correctly.

Example: Typing didn't will give the foll. error but typing didnt will not.



You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
't show much interest for this idea.


I post the text into the script like this .



$discussions = $_POST["discussions"];
$disc1=stripslashes($discussions); //strip /
$disc2 = nl2br ($disc1); //convert CR to BR


and the relevant sql is

UPDATE `Report` SET `Discussions` = '$disc2' and the rest of the fields.



I even changed the above to



UPDATE `Report` SET `Discussions` = '$discussions'
but the syntax error persists.

Please let me know how i can solve this. Thanks

Brandoe85
02-07-2006, 03:30 PM
Read:
addslashes() (http://us2.php.net/addslashes)
stripslashes() (http://us2.php.net/manual/en/function.stripslashes.php)

Let us know if you still can't get it going after that.

Good luck;

swatisonee
02-23-2006, 06:36 AM
Thank you.