$query= mysql_query("Select * From owners");
while($row = mysql_fetch_array($query))
{
$c = $row['ownid'];
$d = $row['owners'];
$res= mysql_query("UPDATE buildings SET owner='$d' WHERE ownerid='$c'");
}
Here are the facts:
Table1: buildings row: ownerid Table2: Owners row: ownid
Now, he wants to update the value from row ownerid in Table buildings to row ownid in Table Owners.
Let say buildings row ownerid (data as follow)
id
1
2
3
4
he wants the ID to be "copied" exactly the same order and same data entirely to row ownid in Table Owners.
I have searched around and found a couple other solutions: trigger???
But I want to conserve his codes, as the logic isn't wrong I think? I am not expert so please someone guide my friend through this.


Sign In
Create Account


Back to top










