DaveLinger Posted June 29, 2007 Author Share Posted June 29, 2007 NOW we're getting somewhere. It's now correctly knowing it needs to ADD, not UPDATE. 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 ''rid', 'uid', 'rating') values ('4', '1', '5')' at line 2 query = INSERT INTO ratings ('rid', 'uid', 'rating') values ('4', '1', '5') Quote Link to comment Share on other sites More sharing options...
DaveLinger Posted June 29, 2007 Author Share Posted June 29, 2007 This is very close to working. If I manually add a row with values: rid=4, uid=1, rating=2, it DOES say "Rating Updated Successfully", and it DOES update it. Quote Link to comment Share on other sites More sharing options...
corbin Posted June 29, 2007 Share Posted June 29, 2007 INSERT INTO ratings ('rid', 'uid', 'rating') values ('4', '1', '5') For column names you use backticks (`s), and for values you use single quotes ('s). Try INSERT INTO ratings (`rid`, `uid`, `rating`) values ('4', '1', '5'). Actually, with this query, I don't think you need any of the backticks since the column names aren't reserved words, but I like to use them anyway ;p. Quote Link to comment Share on other sites More sharing options...
DaveLinger Posted June 29, 2007 Author Share Posted June 29, 2007 INSERT INTO ratings ('rid', 'uid', 'rating') values ('4', '1', '5') For column names you use backticks (`s), and for values you use single quotes ('s). Try INSERT INTO ratings (`rid`, `uid`, `rating`) values ('4', '1', '5'). Actually, with this query, I don't think you need any of the backticks since the column names aren't reserved words, but I like to use them anyway ;p. Yeah that did it thanks! Thanks to Thorpe, too, he actually said that a few posts back but I misunderstood and made all of the values in quotes, even column names. 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.