justAnoob Posted May 15, 2009 Share Posted May 15, 2009 Sorry,, I have lots of questions..... I get a syntax error,, why?,,, everthing looks right. <?php mysql_query("INSERT INTO abcxyz(imgpath2)VALUES('$imgpath')WHERE id = '$idnumber'") or die(mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 What's the syntax error message? Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 15, 2009 Author Share Posted May 15, 2009 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 id = '2'' at line 1 Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 OH, should have caught that. INSERT has no WHERE clause. http://dev.mysql.com/doc/refman/5.1/en/insert.html Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 15, 2009 Author Share Posted May 15, 2009 So then I can't insert something into a row with a specific id?(the id changes depending what picture they are viewing.) Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 Wait, so ID is not a PK? Um, in that case, just use INSERT with 2 value fields. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 15, 2009 Author Share Posted May 15, 2009 Could I just use UPDATE instead of INSERT? I'll be back in a bit. I want to try a few things. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 15, 2009 Author Share Posted May 15, 2009 UPDATE works out good... Any downside to using it??? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 UPDATE works out good... Any downside to using it??? Well everything has a down side. Just make sure you update just the info you want. Quote Link to comment 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.