pneudralics Posted July 3, 2009 Share Posted July 3, 2009 Parse error: syntax error, unexpected T_VARIABLE The error is on the 1st line below. Can't seem to figure out what's wrong with the below. Looks like I'm following the correct syntax. $insertsigns = "INSERT INTO temp (userid, title, type, category, image, timestamp) VALUES (\"$id\", \"$title\", 'Books', \"$categoryname\", \"$newname2\", NOW())"; Quote Link to comment https://forums.phpfreaks.com/topic/164601-solved-cant-figure-out-why-im-getting-parse-error-unexpected-t_variable/ Share on other sites More sharing options...
Andy-H Posted July 3, 2009 Share Posted July 3, 2009 $insertsigns = "INSERT INTO temp (userid, title, type, category, image, timestamp) VALUES ('" . $id . "', '" . $title . "', 'Books', '" . $categoryname . "', '" . $newname2 . "', NOW() )"; If userid stores numeric data, remove the ' ' around the " . $id . " Also, should the timestamp field use the time() function? Quote Link to comment https://forums.phpfreaks.com/topic/164601-solved-cant-figure-out-why-im-getting-parse-error-unexpected-t_variable/#findComment-868113 Share on other sites More sharing options...
pneudralics Posted July 3, 2009 Author Share Posted July 3, 2009 Uhmm.. still getting the error. The error is referring to the 1st line prior to VALUES. $insertsigns = "INSERT INTO temp (userid, title, type, category, image, timestamp) VALUES ('" . $id . "', '" . $title . "', 'Books', '" . $categoryname . "', '" . $newname2 . "', NOW() )"; Quote Link to comment https://forums.phpfreaks.com/topic/164601-solved-cant-figure-out-why-im-getting-parse-error-unexpected-t_variable/#findComment-868134 Share on other sites More sharing options...
Philip Posted July 3, 2009 Share Posted July 3, 2009 Please post the full error, with a few lines before/after the specified line in the error. Quote Link to comment https://forums.phpfreaks.com/topic/164601-solved-cant-figure-out-why-im-getting-parse-error-unexpected-t_variable/#findComment-868137 Share on other sites More sharing options...
pneudralics Posted July 3, 2009 Author Share Posted July 3, 2009 Please post the full error, with a few lines before/after the specified line in the error. Thanks for pointing that out. Saw a ; missing from the line above calling a function I created. Just don't know why the error was pointing to the line below it. Quote Link to comment https://forums.phpfreaks.com/topic/164601-solved-cant-figure-out-why-im-getting-parse-error-unexpected-t_variable/#findComment-868139 Share on other sites More sharing options...
Philip Posted July 3, 2009 Share Posted July 3, 2009 It is because when PHP reads the code, it sees it like this: someFunction()$var = 'blahh'; when it should be: someFunction();$var = 'blahh'; Remember, a semicolon means end of that line. Quote Link to comment https://forums.phpfreaks.com/topic/164601-solved-cant-figure-out-why-im-getting-parse-error-unexpected-t_variable/#findComment-868141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.