Jump to content

Apostrophe in database name value causes SQL error...what to do?


socalnate

Recommended Posts

I run a database that has a significant amount of apostrophe's (') as the ' in cd's.  Problem is when I run an SQL query the SQL query is interpreting the apostrophe as part of a statement and it gives me an error.  If I remove the apostrophe I don't get an error.  Any ideas on how to fix this?  I'm going to sleep on it... :P

 

Nathan 

 

"I program, therefore, I am."

 

 

 

 

rajivgonsalves  is correct. All data should be escaped before an insert/update is attempted. Use one of these functions depending on your version of MySQL:

 

http://us3.php.net/manual/en/function.mysql-real-escape-string.php

 

http://us3.php.net/manual/en/function.mysqli-real-escape-string.php

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.