advancedfuture Posted December 2, 2007 Share Posted December 2, 2007 I am getting the following error on line 33. "Parse error: parse error, unexpected T_STRING in videoUpload.php on line 33" Is my query string malformed? line 31 $query = "INSERT INTO users (video_url) VALUES($path) line 32 WHERE username = test; line 33 mysql_query($query) or trigger_error("FATAL ERROR: " . mysql_error(), E_USER_ERROR); Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/ Share on other sites More sharing options...
trq Posted December 2, 2007 Share Posted December 2, 2007 Your missing a spaces afetr (VALUES) and also the closing " on line 32. Note if it is a string your attempting to insert $path will need to be surrounded by single quotes also. Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/#findComment-404496 Share on other sites More sharing options...
advancedfuture Posted December 2, 2007 Author Share Posted December 2, 2007 hmm nope still getting a parse error on line 33 Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/#findComment-404502 Share on other sites More sharing options...
GingerRobot Posted December 2, 2007 Share Posted December 2, 2007 Note if it is a string your attempting to insert $path will need to be surrounded by single quotes also. As will 'test' hmm nope still getting a parse error on line 33 Can you show us the new code please? Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/#findComment-404504 Share on other sites More sharing options...
advancedfuture Posted December 2, 2007 Author Share Posted December 2, 2007 New code as follows $path= "upload/".$new_file_name; //Connect to Database and write the URL into the profile mysql_connect("x.x.x.x"," xxxxxxx ","xxxxxxxxx"); $query = "INSERT INTO users (video_url) VALUES ('$path') WHERE username = 'test';" mysql_query($query) or trigger_error("FATAL ERROR: " . mysql_error(), E_USER_ERROR); mysql_close(); Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/#findComment-404511 Share on other sites More sharing options...
GingerRobot Posted December 2, 2007 Share Posted December 2, 2007 You need to close the string before the semi colon: $query = "INSERT INTO users (video_url) VALUES ('$path') WHERE username = 'test'"; Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/#findComment-404513 Share on other sites More sharing options...
advancedfuture Posted December 2, 2007 Author Share Posted December 2, 2007 lol I feel dumb now Thanks for the help though gentlemen! Link to comment https://forums.phpfreaks.com/topic/79884-solved-possible-malformed-query-string/#findComment-404516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.