Jump to content

[SOLVED] Code returning false mysql result


DaveLinger

Recommended Posts

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')

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.