I am having problems with entering data into MySQL from a PHP script. I am taking the data from an array generated by a CSV parsing routine. That in itself works great, however I have large number of data units with '-' characters in (hyphens) and it is causing the SQL queries to dump out with an error in the syntax. I can't get around it by putting a slash in front of them (using 'addcslashes'), it will just not at all accept them. Are they the 'wrong' type of slash? Is there an easy way to search and replace/remove characters in a string in PHP?
If you're quoting these values, you should be having no problem.
e.g. INSERT into TABLE_FOO (colname) values ('-');
but this will error: INSERT into TABLE_FOO (colname) values (-);
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php