cip6791 Posted August 23, 2008 Share Posted August 23, 2008 Hi all, I have a question. I currently use a classifieds script that deletes the ad after a certain amount of time. So I lose the e-mail which was used to post the ad. I would like to copy the existing email from the ads table to another table and keep them there for future use. Does anybody have any idea how this can be done? I would like it to be automatically copied into the new table. Thanks Link to comment https://forums.phpfreaks.com/topic/120969-mysql-copy-from-one-table-to-another/ Share on other sites More sharing options...
AjBaz100 Posted August 23, 2008 Share Posted August 23, 2008 when the script that runs deletes the ad, you could add another query to first insert the records into another table. I can't remember the exact syntax of the top of my head, but if you look into using the INSERT INTO query. Link to comment https://forums.phpfreaks.com/topic/120969-mysql-copy-from-one-table-to-another/#findComment-623636 Share on other sites More sharing options...
cooldude832 Posted August 23, 2008 Share Posted August 23, 2008 try something like Insert into `emails` (AdName, Email) Values(Select Name, Email from `ads` where Id = IDHERE)) and then delete Link to comment https://forums.phpfreaks.com/topic/120969-mysql-copy-from-one-table-to-another/#findComment-623640 Share on other sites More sharing options...
fenway Posted August 25, 2008 Share Posted August 25, 2008 try something like Insert into `emails` (AdName, Email) Values(Select Name, Email from `ads` where Id = IDHERE)) and then delete No, not at all... that won't work. I have a question. I currently use a classifieds script that deletes the ad after a certain amount of time. So I lose the e-mail which was used to post the ad. Why not use a datetime field to mark the record as expired, instead of deleting it? Link to comment https://forums.phpfreaks.com/topic/120969-mysql-copy-from-one-table-to-another/#findComment-625071 Share on other sites More sharing options...
Mchl Posted August 25, 2008 Share Posted August 25, 2008 Why not insert email when inserting the ad, not when deleting it? You'll need it anyways. Link to comment https://forums.phpfreaks.com/topic/120969-mysql-copy-from-one-table-to-another/#findComment-625226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.