title: mysql - move rows from one table to another or update
body: <p>PLOT : i have a PAD websites with 2 DB's : submitdata and maindata .
  The submitdata DB has all the columns as maindata DB plus another 3 columns :</p>
  
  <p>MAINDATA COLUMNS     : name link email website .... progid
  SUBMITDATA COLUMNS : name link email website .... progid, backlink, affiliateid</p>
  
  <p>I must MOVE all rows from submitdata DB to maindata DB but only IF backlink !='' and IF affiliateid != $affiliateid .</p>
  
  <p>Another problem is if the progid is allready in the maindata DB and it this case I must UPDATE that row with the new data 
  ... another problem is that i have about 40.000 rows so SELECT * FROM submitdata kinda kills my computer .</p>
  
  <p>Any ideea on how to do that in PHP ?</p>