Do you guys know why this code:
##################
$fname1 = addslashes(trim($HTTP_POST_VARS['fname1']));
$lname1 = addslashes(trim($HTTP_POST_VARS['lname1']));
$fname2 = addslashes(trim($HTTP_POST_VARS['fname2']));
$lname2 = addslashes(trim($HTTP_POST_VARS['lname2']));
// just printing this for testing sake
print "$fname1 <br>";
print "$lname1 <br>";
print "$fname2 <br>";
print "$lname2 <br>";
// this is the data that is going to go into the "people" table
$insert_people = "INSERT INTO people (".
"unique_id, open, fname1, lname1, fname2, lname2,".
"phone1, phone1type, phone2, phone2type, phone3, phone3type,".
"email, address1, address2, city, state, zip,".
"foundout, agegroup, marriagestatus, service, children)".
"VALUES(".
"'$unique_id', '0', '$fname1', '$lname1', '$fname2', '$lname2',".
"'$phone1', '$phone1type', '$phone2', '$phone2type', '$phone3', '$phone3type',".
"'$email', '$address1', '$address2', '$city', '$state', '$zip',".
"'$foundout', '$agegroup', '$marriagestatus', '$service', '$children')";
$mysql_insert = mysql_query($insert_people, $mysql_link)
or die("Bad query: ".mysql_error());
###################
##################
Would give me this error:
Aaron
O\'Conner
Ashley
Judd
Bad query: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Conner', '0', 'Aaron', 'O\'Conner', 'Ashley', 'Judd','', 'Home'
It has something to do with the ' character, but I'm adding slashes to prevent that.
Any help would be great,
thanks