0

Now that's a long title!

Stackoverflow has been a favorite of mine for years, but this is my first post. I'm an amateur coder and have not developed much over the last 12 years ... Mainly because I get to do too little coding as I have a different day job.

I'm trying to write a code, with the limited skills I have, that does what the title says. So far the example below is my best shot. Spent the best part of 2 days do end up here - but it does not do the trick.

Any hints that could send me in the right direction will be much appreciated. Preferably based on code that I have a chance of understanding.

// connect to the two DB's
$lokal = mysql_connect("localhost", "db", "password", "user") or die    ("Cannot connetct to the local db");
$ekstern = mysql_connect("some.db.no", "db", "password", "user") or die ("Cannot connect to the external db");

// Get data from the local table and update the external
$result = mysql_query("SELECT * FROM menus", $lokal);
    while ($row = mysql_fetch_assoc($result)) {
        mysql_query("UPDATE menus SET row2=$row['row2'], row3=$row['row3'], row4=$row['row4'] WHERE row1=$row['row1']", $ekstern);
    }

mysql_close($lokal);
mysql_close($ekstern); 

echo "Complete"; 

Your help is MUCH appreciated!

jogyth
  • 9
  • 2

0 Answers0