Guest elthomo Posted March 6, 2008 Share Posted March 6, 2008 PHP/MYSQL copy fields in table to new table if data exists in fields. To simplify I have some address data that I want users to be able to update but I also want to keep the old address. Could someone let me know the correct syntax for this? Quote Link to comment Share on other sites More sharing options...
Isityou Posted March 6, 2008 Share Posted March 6, 2008 Pull the information from the old address and create a new entry with the new address. Than when the user updates it again delete the previous old address and repeat. Quote Link to comment Share on other sites More sharing options...
Guest elthomo Posted March 6, 2008 Share Posted March 6, 2008 Thanks, But I actually mean the php/mysql syntax Quote Link to comment Share on other sites More sharing options...
Isityou Posted March 6, 2008 Share Posted March 6, 2008 So you want someone to write the code for you? Quote Link to comment Share on other sites More sharing options...
Guest elthomo Posted March 6, 2008 Share Posted March 6, 2008 No I understand the logic, but I'm unsure of the syntax. So what I would like to know is the syntax and not have the code written for me. I have unsuccessfully googled for the info required and could just use a little help. Quote Link to comment Share on other sites More sharing options...
Guest elthomo Posted March 6, 2008 Share Posted March 6, 2008 Actually I think I may have found what I need INSERT INTO table_name SELECT * FROM table_name2 WHERE Field_Name = $field_name AND Field_Name2 = $$field_name2 Quote Link to comment Share on other sites More sharing options...
aschk Posted March 6, 2008 Share Posted March 6, 2008 Why are you copying this into another table? You going to create a new table every time a person's address changes Just have it all in 1 table, and have a timestamp on the information. Then just pull the latest information using MAX(timestamp_column). Quote Link to comment Share on other sites More sharing options...
Guest elthomo Posted March 6, 2008 Share Posted March 6, 2008 I didn't know that was possible!!! but i do now. So I will look into it thank you Quote Link to comment 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.