I am using PHP for inserting data in mysql database. But it gives me error that - Parse error on "Insert" query. Please help me as early as possible. I am giving my code also. Pl. suggest me what to do for it.
code---
<?
$usr="mohan";
$pwd="bajare"';
$host="localhost";
$db="testData";
$cid=mysql_connect($host,$usr,$pwd);
if (!$cid) { echo(mysql_error());}
else
{
$sql="insert into UserMaster values ('$LName','$LPass')";
$result=mysql_db_query($db,$sql,$cid);
echo ("New Record added!");
}
mysql_close($cid);
?>
I am facing Parse Error while inserting data
Moderators: egami, macek, gesf
something is wrong with you're query.
either the table "UserMaster" (case sensitive) doesn't exist.
or the table hase more or less than 2 colums.
or $LName and/or $LPASS has got one or more ' in it's string. In that case use addslashes to escape those.
Greetz Daan
either the table "UserMaster" (case sensitive) doesn't exist.
or the table hase more or less than 2 colums.
or $LName and/or $LPASS has got one or more ' in it's string. In that case use addslashes to escape those.
Greetz Daan
Maybe you have in "UserMaster" table more then two fields with "not allow nulls" option (e.g "id" field without autoincrement), or your variables $LName, $LPass includes single qoutes?
------------------------
With best regards,
Serge Bulanov
AlarIT Web developer,
www.AlarIT.com
------------------------
With best regards,
Serge Bulanov
AlarIT Web developer,
www.AlarIT.com