I am facing Parse Error while inserting data

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

Fri Oct 11, 2002 8:30 pm

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.

if (!$cid) { echo(mysql_error());}
$sql="insert into UserMaster values ('$LName','$LPass')";
echo ("New Record added!");


Sat Oct 12, 2002 12:12 am

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

New php-forum User
New php-forum User
Posts: 14
Joined: Mon Sep 16, 2002 1:25 am
Location: Ukraine

Mon Oct 14, 2002 12:00 am

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,

Post Reply