hello. going from help i received recently regarding passing strings to MySQL db while avoiding the "error in your SQL syntax" fumble when a name such as O'Connor or anything w/ an apostropy and/ or other punctuation, such as he's in trouble, and she's very angry-- lookout, y'all! is entered as $POST data passed in a mysql_query(), my SQL variable looks like this:
$insertquery = "INSERT INTO interest SET
F_NAME = '" . addslashes($_POST['F_NAME']) . "',
L_NAME = '" . addslashes($_POST['L_NAME']) . "',
EMAIL = '" . addslashes($_POST['EMAIL']) . "',
PHONE = '" . addslashes($_POST['PHONE']) . "',
REMARK = '" . addslashes($_POST['REMARK']) . "'";
this code works perfectly on my local testing server, such that the above text, entered as $_POST data goes into my local MySQL db as "O'Connor", and "he's in trouble, and she's very angry-- lookout, y'all!". however, using the same code on my hosting server will enter the following into the MySQL table fields "O\'connor" and "he\'s in trouble, and she\'s very angry-- lookout y\'all!".
so, how then should my code be modified so that i don't get a SQL syntax error, yet i don't get those slashes in my db either?