I have my own way of doing this, but I'm not sure it's best. I would like an expert opinion.
In php, I have a query statement like that is created and then sent to MySQL for processing (I have a function that does all my processing). It reads the data from table A and inserts iinto table B.
A = 101
B = Tom
C = Smith
A = 100
B = Frank
C = O'Connor
$query = "INSERT INTO table (field1, field2, field3) VALUES ( ".$A.", '".$B."', '".$C."')";
$C =str_replace("'", "'", $C
When it reads the first record, the query works fine.
But when it reads the second entry, it crashes on the apostrophe between O and Connor.
I don't want to use "add slashes" because then it puts an unnecessary slash in the database.
I can use str_replace and replace all of the apostrophes with the ascii character (e.g. see line 3 in code above) but I think there must be a better way...
Your insight please...