So I am trying to update a table from a MYSQL database with values from another table. I want to replace the values for each row of Columns A and B in table 1 with the values for each row of Columns C and D in table 2. How do I do this?
Is there a condition on how to replace the values? I mean which values from which row in table 1 replaces rows in table 2?
$query= mysql_query("Select * From table2"); while($row = mysql_fetch_array($query)) { $c = $row['C']; $d = $row['D']; $res= mysql_query("UPDATE table1 SET B='$d' WHERE C='$c'"); } PHP: