-1
Hello!
I’m doing an Insert/update in a database through a csv file. I have problems when I try to upload the file and it finds data with simple quotes, for example: "SANTA BARBARA D'OESTE".
My Internet has stayed:
$sql = mysql_query(
"INSERT INTO tabela SET
`dado1`= '$data[0]',
`dado2`= '$data[1]',
`dado3`= '$data[2]'")
Then I thought to make a string_replace to see if it worked, with simple quotes does not work, because he understands that it is an open quote:
$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 quotes also did not roll, even because the syntax is with single quotes right
$dado1= $data[1];
$dado_alt = str_replace("'","",$dado1);
What can I do to fix this? Thank you!!
I believe it is the same problem, properly solved: Problem with php query because of quotation marks
– Bacco
Since there was no other activity in the post, I closed it as a duplicate. I understand that the solution is on the link indicated, but if you have any questions, leave a comment that we will try to help.
– Bacco