Dario,
I tried that with my array, but I keep getting an "invalid query" error when executing the 2nd mysql_query to $newlink. It parses ok. I am transferring a website to a new server using a different script and I'm trying to move my users from the old database to the one:
<?php
$link = mysql_connect("oldserver", "oldname", "oldpass")
or die("Could not connect");
mysql_select_db("olddb", $link)
or die("Could not select database");
$user_res = mysql_query("SELECT DISTINCT
userid, username, useraddress, password FROM oldtable ORDER BY userid, username, useraddress, password")
or die("Invalid query");
while ($row = mysql_fetch_assoc($user_res)) {
$newlink = mysql_connect("newserver", "newid", "newpass")
or die("Could not connect");
mysql_select_db("newdb", $newlink);
$newresult = mysql_query("INSERT INTO newtable (uname, email, pass) VALUES ('{$row["username"]}', '{$row["useraddress"]}', '{$row["userpassword"]}')", $newlink)
or die("Invalid query");
}
mysql_free_result($user_res);
mysql_close($link);
mysql_close($newlink);
?>
Any help would be greatly appreciated!
Susan