Jump to content

Parse Error


foucquet

Recommended Posts

Why does this :-

 

// Insert data into database
$insert = "INSERT INTO users(nick, password, email, sex, regdate) VALUES('$_POST['nick']', '$_POST['pwd']', '$_POST['email']', '$_POST['sex']', '$today')";

$add_member = mysql_query($insert);

 

give me this:-

 

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\php\test site\regproc.php on line 40

 

I know it is probably something to do with quotation marks, but having tried every combination that I can think of I still can't work it out...

Link to comment
https://forums.phpfreaks.com/topic/211268-parse-error/
Share on other sites

Hi

 

I am not keen on trying to use arrays in string like that so tend to just concatenate the array vars in like this

 

// Insert data into database
$insert = "INSERT INTO users(nick, password, email, sex, regdate) VALUES('".$_POST['nick']."', '".$_POST['pwd']."', '".$_POST['email']."', '".$_POST['sex']."', '$today')";

$add_member = mysql_query($insert); 

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/211268-parse-error/#findComment-1101575
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.