views:

31

answers:

3

im trying to insert data into a particular row in the database, but i mysql is saying this is an error:

INSERT INTO user (rep, course) VALUES('5', 'computer science') WHERE user='2'
+2  A: 
UPDATE user 
   SET rep = '5', course = 'computer science' 
 WHERE user = '2'

Link to docs.

Adam Bernier
+1  A: 

You might want to UPDATE instead,

UPDATE user set rep='5', course='computer science' WHERE user='2'
nos
oh my god, i am so stupid, i totally forgot about update, thank god my db admin is not on stackoverflow ::))) cheers nos
getaway
A: 

INSERT statement should not come with WHERE clause.

ngsiolei