socalnate Posted October 27, 2007 Share Posted October 27, 2007 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... Nathan "I program, therefore, I am." Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted October 27, 2007 Share Posted October 27, 2007 can you give the sql you are running you can escape the ' by using \ Quote Link to comment Share on other sites More sharing options...
toplay Posted October 27, 2007 Share Posted October 27, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.