Mysql Query

Hi Guys,
i have a chat table that has 4 columns (id,inbox,sent,userID,time) , i wrote a php code that would insert into this table all the data except for the sent column, because this column is filled out by another code, the problem that i have is how can i insert into (sent) for a specific (userID), this is what i wrote but it’s returns error in mysql

INSERT INTO chat (sent) VALUES (‘bla bla’) where userid=5

Hey Ali,

You need to use and Update Statement to accomplish updating a row that already exists. Something like.

[php]UPDATE chat SET sent = ‘blah blah’ WHERE userid=5[/php]

thank you for your feedback, is the update statement are the only way to insert data in a columns that’s already exists?

Sponsor our Newsletter | Privacy Policy | Terms of Service