MySql UPDATE creates new record
Posted: Wed May 27, 2009 11:17 am
Hi Guys,
Finally decided to sign up because I couldn't find a topic on this. Everyone has been most helpful in the past!
I have a table that stores 'news items'. This contains an auto-increment column for creating unique id's for each item.
Problem is, whenever I load edit and submit this information via an 'update' sql statement (see below), a new record is created and the original is left in tact, so Two news items now appear. Is it purely that you can not 'update' records that use the auto-increment?
"UPDATE news SET title='$title', body='$body' WHERE id='$id'"
Thanks in advance!
J
Finally decided to sign up because I couldn't find a topic on this. Everyone has been most helpful in the past!
I have a table that stores 'news items'. This contains an auto-increment column for creating unique id's for each item.
Problem is, whenever I load edit and submit this information via an 'update' sql statement (see below), a new record is created and the original is left in tact, so Two news items now appear. Is it purely that you can not 'update' records that use the auto-increment?
"UPDATE news SET title='$title', body='$body' WHERE id='$id'"
Thanks in advance!
J