I am loading a CSV file into a table. All name that do not contain an apostrophe load fine, but one like "O'Reilly" throw warnings (even though they load into the table). I am doing this with a PHP page. Below is my code. Does anyone know how to ignore single quotes on a load command or any other way around this?
// on inputting to the database
$current_file = addslashes($current_file);
// on retrieval from the database
$current_file = stripslashes($current_file);
Will the addslashes make the import ignore the single quotes because it is escaping it? Once it is in the database I can retrieve it without a problem using double quotes.
basically the reason it was "crashing" is because PHP thinks the ' is part of the actual PHP code and not the MySQL code, therefore crashing PHP with a syntax error, escaping it allows the value to be altered for database storage and then returned to normal when retrieving.