systemsgotyou Posted January 22, 2014 Share Posted January 22, 2014 I am trying to copy two pieces of info from a table into a new table. I know if I wanted to do one piece of data it would look like this: $getemaipips = "SELECT emailaddress FROM zzemail_list_subscribers LIMIT 1"; $getemaipips_rst = $database->prepare($getemaipips); $getemaipips_rst ->execute(); /* * */ foreach ($getemaipips_rst->fetchAll(PDO::FETCH_ASSOC) as $data) { $email = $data['emailaddress']; $newlistid = $twentyfivedaylistid; But if I wanted to do that for TWO fields how would it look? Can I do a select AND command? Quote Link to comment Share on other sites More sharing options...
systemsgotyou Posted January 22, 2014 Author Share Posted January 22, 2014 never mind got it! use a comman between field! Quote Link to comment Share on other sites More sharing options...
Barand Posted January 22, 2014 Share Posted January 22, 2014 Single query INSERT INTO table2 (colA, colB) SELECT col1, col2 FROM table1 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.