Fix Data Entry Problem. Backslashes And Apostrophes


I have a glitch in a script

As soon as an apostrophe or backslash is used in any field I get the following error.

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 ‘1” at line 16
UPDATE users SET password=’test’, last_name=”, street=”, city=”, state=”, zip=”, country=”, email=”, bname =’test’, cemail=”, website=’’, baddress=”, activate=’1′, pcat=’28’, aboutme=”’, byear=”,telephone=” WHERE uid=’1′

Here’s a link you can try.

The login is test and pass is test.

When you try to update anything with an apostrophe or backslash it creates the error above.

I figure I need some kind of code inserted

// double-up apostrophes
for example: $description = str_replace(“‘”,”””,$description);

I’d someone to fix the script so no matter which field they insert an apostrophe or backslash that it doesn’t create this error.

Thank you

Leave a Reply

Your email address will not be published.