Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

I am facing Parse Error while inserting data

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

I am facing Parse Error while inserting data

Postby Mohan » 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.
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);
?>
Mohan
New php-forum User
New php-forum User
 
Posts: 5
Joined: Fri Oct 11, 2002 8:17 pm

Postby DoppyNL » 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
DoppyNL
 

Postby serge » 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,
www.AlarIT.com
serge
New php-forum User
New php-forum User
 
Posts: 14
Joined: Mon Sep 16, 2002 1:25 am
Location: Ukraine


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.