Problem in php database record....
Posted: Mon Oct 12, 2009 11:55 pm
I encountered a problem when i was going to record a database for my project through cms code . I use easyphp and I want to save database through the site itself. but the following error occured when i gave datas Like name-john address 7th floor .and so on.......
Could not add recordYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"advertising_agencies" value ("John","7th floor","124564687546")
my code:-
$sql= 'insert into "'.$table.'" value ("'.$_POST['name_txt'].'","'.$_POST['add_txt'].'","'.$_POST['phone_txt'].'")';
if(!mysql_query($sql,$con))
{
die('Could not add record' . mysql_error());
}
else
{
print "Record Added Sucessfully";
include 'setting_form.php';
}
}
}
Could not add recordYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"advertising_agencies" value ("John","7th floor","124564687546")
my code:-
$sql= 'insert into "'.$table.'" value ("'.$_POST['name_txt'].'","'.$_POST['add_txt'].'","'.$_POST['phone_txt'].'")';
if(!mysql_query($sql,$con))
{
die('Could not add record' . mysql_error());
}
else
{
print "Record Added Sucessfully";
include 'setting_form.php';
}
}
}