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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.