annaright Posted November 12, 2011 Share Posted November 12, 2011 hi anyone here know how to insert data without overwrite the existing or current data in a table. i have a table which is store a health information, this health information will change week by week, so i don't want to overwrite information and i want keep as a history info Quote Link to comment https://forums.phpfreaks.com/topic/251023-how-to-insert-data-without-overwrite-old-data-in-the-same-table/ Share on other sites More sharing options...
floridaflatlander Posted November 12, 2011 Share Posted November 12, 2011 It wont over write it unless you use UPDATE .... WHERE id=id or something like that If you use insert it will add to the records not over write Quote Link to comment https://forums.phpfreaks.com/topic/251023-how-to-insert-data-without-overwrite-old-data-in-the-same-table/#findComment-1287675 Share on other sites More sharing options...
fenway Posted November 13, 2011 Share Posted November 13, 2011 I don't understand the question -- just keep everything. Quote Link to comment https://forums.phpfreaks.com/topic/251023-how-to-insert-data-without-overwrite-old-data-in-the-same-table/#findComment-1287785 Share on other sites More sharing options...
annaright Posted November 15, 2011 Author Share Posted November 15, 2011 I don't understand the question -- just keep everything. sorry maybe my question a bit confusing, its not INSERT but UPDATE....i want to update a table which is already have a data in the same time i don't want to overwrite the existing data. example; Table person: P_Id LastName FirstName Address City 1 John Mayer Street 1 London 2 Ray Caroline Street 2 Leeds UPDATE Persons SET Address='Street3', City='Manchester' WHERE LastName='Ray' AND FirstName='Caroline' The "Persons" table will now look like this: P_Id LastName FirstName Address City 1 John Mayer Street 1 London 2 Ray Caroline Street 3 Manchester but I still want to keep the previous data before the update as a history. sorry my english really bad Quote Link to comment https://forums.phpfreaks.com/topic/251023-how-to-insert-data-without-overwrite-old-data-in-the-same-table/#findComment-1288259 Share on other sites More sharing options...
fenway Posted November 15, 2011 Share Posted November 15, 2011 Then it's an INSERT -- not an UPDATE. Just store the date alongside each recod. Quote Link to comment https://forums.phpfreaks.com/topic/251023-how-to-insert-data-without-overwrite-old-data-in-the-same-table/#findComment-1288347 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.