foucquet Posted August 20, 2010 Share Posted August 20, 2010 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 More sharing options...
kickstart Posted August 20, 2010 Share Posted August 20, 2010 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 More sharing options...
foucquet Posted August 20, 2010 Author Share Posted August 20, 2010 Thanks Keith, that works perfectly, it was the only thing I didn't try as I thought it was not possible to do this... Link to comment https://forums.phpfreaks.com/topic/211268-parse-error/#findComment-1101578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.