Thursday, July 30, 2009

Parse error: parse error, unexpected T_STRING in C:\Program Files\EasyPHP 2.0b1\www\matrimonial\reg_acti...

the code is:


if(mysql_query("INSERT INTO registration (name,age,gender,mstatus,numchildren,chi... or die mysql_error();)

Parse error: parse error, unexpected T_STRING in C:\Program Files\EasyPHP 2.0b1\www\matrimonial\reg_acti...
based on your example these are the errors:





correct syntax for die() is die(mysql_error());


correct syntax for mysql_query and INSERT INTO is mysql_query("INSERT INTO registration VALUES('name','age','gender','mstatus','... or die(mysql_error());





however, your parse error tells me that you are missing a 'semicolon' on one of your lines, if you could post the whole code, then we could find out what is really wrong.
Reply:METHOD 1





if(mysql_query("INSERT INTO ....")){


// What to do if query succeeds?


}


else{


die(mysql_error());


}





----------------





METHOD 2


mysql_query("INSERT INTO ...") or die(mysql_error());

bottle palm

No comments:

Post a Comment