I have my database in which a user enters a message and it stores in the database. but with every new message from the same user, the new message overwrites the old message. this is the problem. I want to keep all the messages. so how can I do it? I use PHP for connecting to my PHPMyAdmin database.
INSERT INTO users SET `message` = "hdfh" ,`budget`="5235" , `media`="ghdh" WHERE username='somen8099' ;
there is error on the above line.
2
Answers
sounds like you could be using update instead of insert, also check if the database has any triggers set to delete on new inserts
It would be nice if you shared some codes, especially the code where you insert data. As i see it there could be 1 problem.
You are not inserting, but rather, updating the same row. In that case you are probably using something like
UPDATE MESSAGES SET Message = ?,User_id = ? WHERE id = ?
You should be using
INSERT INTO MESSAGES SET Message = ?,User_id = ?
. This answer might be irrelevant with your problem but again, the information provided is limited.