Look at the INSERT... SELECT syntax in the MySQL manual
Basically you can do this but only between 2 different tables (which is what you specified) :
Generate and *test* the SELECT statement you want to use to recover your data set.
Then in PHP try a query like this :
$query="INSERT INTO table2 ( id, name, address1, address2, address3, password )
SELECT id, name, address1, address2, address3, ' ".$your_password_key." '
So here you have selected the 4 fields form table 1 and added a password key added from a PHP variable
Possibly not the best example but you get the idea.
At 02:06 22/06/2004 +0000, you wrote:
Date: Tue, 22 Jun 2004 12:06:41 +1000 Message-ID: <[EMAIL PROTECTED]> From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: Retrieve data, add new fields and enter it in new table
I am trying to do the following: - retrieve data from a table based on the $id field (easy enough) - add a few more fields to the data set, then - enter the data (and new fields) into a new table (based on the selected $id field)
I'm just not sure how to structure this, do I use a temporary table, add the new fields, then move the data set into the target table? Or is there a better way?
======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php