dsaba Posted February 26, 2007 Share Posted February 26, 2007 keep getting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `fileid`=''' at line 1 only at line 110 does sql syntax even begin i keep double checking my variables and my syntax i don't seem to find anythign wrong, maybe I'm not properly spacing the inserts or updates, or queries??? please tell me if this is proper sql syntax for php $query2 = "INSERT INTO `videos` ( `videoname`, `videofileid` )"; $result3 = mysql_query("SELECT filesubmitter FROM mainfilelist WHERE filesubmitter='$videosubmitter'"); $query4 = "UPDATE `userinfo` SET `userip`='$videosubmitter', `userlanguage`='$videosubmitlang', WHERE `username`='$videosubmitter'"; $query4 = "INSERT INTO `userinfo` ( `username`, `userip`, `useremail`, `userwebsite`, `userlanguage`, `userfilecount`, `userlastactive` ) VALUES ( '$svideosubmitter','$svideosubmitterip','$svideosubmitteremail','$svideosubmitterwebsite','$svideosubmitterlang','$userfilecountifnew','$svideodatetime' )"; thanks in advance Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/ Share on other sites More sharing options...
emehrkay Posted February 26, 2007 Share Posted February 26, 2007 get rid of the comma before "where" Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194811 Share on other sites More sharing options...
Archadian Posted February 26, 2007 Share Posted February 26, 2007 $query2 = "INSERT INTO `videos` ( `videoname`, `videofileid` )"; you have the table () but where is the VALUES()? http://www.w3schools.com/php/php_mysql_insert.asp Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194814 Share on other sites More sharing options...
dsaba Posted February 26, 2007 Author Share Posted February 26, 2007 ah sorry i just took snippets from my script here is a more complete look at my insert syntax $query4 = "INSERT INTO `userinfo` ( `username`, `userip`, `useremail`, `userwebsite`, `userlanguage`, `userfilecount`, `userlastactive` ) VALUES ( '$svideosubmitter','$svideosubmitterip','$svideosubmitteremail','$svideosubmitterwebsite','$svideosubmitterlang','$userfilecountifnew','$svideodatetime' )"; Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194815 Share on other sites More sharing options...
Archadian Posted February 26, 2007 Share Posted February 26, 2007 As emehrkay said, take out the comma before WHERE in the UPDATE $query4 Also when it saids line 110 it could be lines 105-115 its not exactly line 110 gotta love MySQL errors Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194817 Share on other sites More sharing options...
HaLo2FrEeEk Posted February 26, 2007 Share Posted February 26, 2007 So basically, your $query4 should be this: $query4 = "UPDATE `userinfo` SET `userip`='$videosubmitter', `userlanguage`='$videosubmitlang' WHERE `username`='$videosubmitter'"; Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194825 Share on other sites More sharing options...
Barand Posted February 27, 2007 Share Posted February 27, 2007 The error mentions ...near 'WHERE `fileid`=''' Nothing you posted contains "WHERE `fileid` =" Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194851 Share on other sites More sharing options...
Archadian Posted February 27, 2007 Share Posted February 27, 2007 i can't believe i didn't catch that, good eye barand yeah that wouldn't cause the error but it would cause your script to return nothing since $videosubmitter is empty Link to comment https://forums.phpfreaks.com/topic/40272-something-wrong-with-my-mysql-syntax/#findComment-194986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.