Chris Ginet Posted March 2, 2007 Share Posted March 2, 2007 Can anybody help me with this code? its not working INSERT INTO fsd_trace (OK,TRACE,ARRIVEE,MAINTENANT) VALUES ('$OK','$TRACE','$ARRIVEE','$MAINTENANT') WHERE CID='$CID'"; I got the error message Error 1064 : 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 ') FROM fsd_trace WHERE CID=`vMOD002`' at line 1 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/ Share on other sites More sharing options...
guyfromfl Posted March 2, 2007 Share Posted March 2, 2007 INSERT INTO fsd_trace (OK,TRACE,ARRIVEE,MAINTENANT) VALUES ('$OK','$TRACE','$ARRIVEE','$MAINTENANT') WHERE CID='$CID'"; no " before insert? Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198248 Share on other sites More sharing options...
Chris Ginet Posted March 2, 2007 Author Share Posted March 2, 2007 sorry, yeah there is "INSERT INTO fsd_trace (OK,TRACE,ARRIVEE,MAINTENANT) VALUES ('$OK','$TRACE','$ARRIVEE','$MAINTENANT') WHERE CID='$CID'"; Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198249 Share on other sites More sharing options...
guyfromfl Posted March 2, 2007 Share Posted March 2, 2007 and why is there a FROM in the error message Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198253 Share on other sites More sharing options...
The14thGOD Posted March 2, 2007 Share Posted March 2, 2007 if you have more than one query statement, you could be referencing the wrong one? or perhaps overwrote it somewhere else in your other php code? Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198258 Share on other sites More sharing options...
Chris Ginet Posted March 2, 2007 Author Share Posted March 2, 2007 sorry, that was on OLD error message, that was sorted the message im getting now is Error 1064 : 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 CID='vMOD002'' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198260 Share on other sites More sharing options...
boo_lolly Posted March 3, 2007 Share Posted March 3, 2007 sorry, that was on OLD error message, that was sorted the message im getting now is Error 1064 : 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 CID='vMOD002'' at line 1 is there a value 'vMOD002' in your database? Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198263 Share on other sites More sharing options...
Chris Ginet Posted March 3, 2007 Author Share Posted March 3, 2007 yep, there is vMOD001 up to vMOD100 Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198264 Share on other sites More sharing options...
kenrbnsn Posted March 3, 2007 Share Posted March 3, 2007 Please post the code that is generating this error. Ken Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198279 Share on other sites More sharing options...
Archadian Posted March 3, 2007 Share Posted March 3, 2007 should there be a WHERE in the INSERT INTO? If you are inserting something in a database that means there is no $CID to compare it to and if there is you need to use UPDATE...not INSERT INTO <--- only makes a new row, which, again, there is nothing in the row or DB table that matches $CID this: "INSERT INTO fsd_trace (OK,TRACE,ARRIVEE,MAINTENANT) VALUES ('$OK','$TRACE','$ARRIVEE','$MAINTENANT') WHERE CID='$CID'"; needs to be this: "UPDATE fsd_trace SET ok = '$ok', trace = '$trace', arrivee = '$arrivee', maintenant = '$maintenant' WHERE CID = '$CID'" thats what it needs to be if you aren't planning on creating a new row in fsd_trace table Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198280 Share on other sites More sharing options...
Chris Ginet Posted March 3, 2007 Author Share Posted March 3, 2007 thanks, was something so simple, im new to PHP Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/40941-solved-help-with-some-code/#findComment-198285 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.