Jump to content

Recommended Posts

This is a stupid easy one but cant for the life of me find the solution.

 

I have a table that holds an ID and 6 empty columns for later use.

 

when I try and select the right id and then populate 1 or more of the empty columns I get a syntax error.

 

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 chatId =  'Chat_1257295904'' at line 1

 

here is the statement:

 

INSERT into invites (player1) values ('Cody') WHERE chatId = 'Chat_1257295904'

 

this is how the table is set up:

 

columns; chatId, player1 - player6

Link to comment
https://forums.phpfreaks.com/topic/180215-solved-insert-into-where/
Share on other sites

In the way you describe your setup, shouldn't you be using an update instead?

UPDATE invites SET player1 = 'Cody' WHERE chatId = 'Chat_1257295904'';

 

It doesn't seem like the string "Cody" is stored in another table by the way you described it.

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.