Hello
I'm doing an insert / update to a database through a csv file. I am having problems when I try to upload the file and it is given with single quotation marks, such as "SANTA BARBARA D'OESTE".
My insert is:
$sql = mysql_query(
"INSERT INTO tabela SET
'dado1'= '$data[0]',
'dado2'= '$data[1]',
'dado3'= '$data[2]'")
I thought of doing a string_replace to see if it worked, with single quotation marks does not work, because it understands that it is an open quotation mark:
$dado1= $data[1];
$dado_alt = str_replace(''','',$dado1);
//ai o insert ficaria assim:
"INSERT INTO tabela SET
'dado1'= '$dado1',
'dado2'= '$data[1]',
'dado3'= '$data[2]'")
And with double quotation marks also did not scroll,
$dado1= $data[1];
$dado_alt = str_replace("'","",$dado1);
What can I do to fix this? Thank you !!