On the insert query remove the "$result = " since the insert will return a null and wipe out the result set produced by the first query.
Warren Vail -----Original Message----- From: Mike Alderson [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 3:52 PM To: [EMAIL PROTECTED] Subject: [PHP] Conversion project problem Hello all. I am trying to gather information from one database, process it, and insert it into a new one. When I run this script I am getting the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\web\aldersonfamily\convert.php on line 11 Here is my code: <? $connectionnew=mysql_connect("localhost","app","aardvark") or die("Can't connect to database new"); $dbnew=mysql_select_db("alderson_cms", $connectionnew) or die("Can't select db cms_alderson"); $connectionold=mysql_connect("localhost","app","aardvark") or die("Can't connect to database $DBASEURL,$DBASENAME,$DBASEPASS"); $db=mysql_select_db("aldersondb1", $connectionold) or die("Can't select db aldersondb1"); $sql="SELECT * FROM users"; $result=mysql_query($sql, $connectionold) or die(mysql_error()); While ($row=mysql_fetch_array($result)) { $id=$row['id']; $fname=$row['fname']; $lname=$row['lname']; $password=$row['password']; $username=$row['username']; $security = crypt("user", 12); $password = crypt($password, 12); $sql = "INSERT INTO cms_users (id, fname, lname, username, email, password, security, origip) VALUES (\"\", \"$fname\", \"$lname\",\"$username\", \"\", \"$password\", \"$security\", \"\")"; $result=mysql_query($sql, $connectionnew) or die(mysql_error()); } ?> Can someone give me an idea of what I'm doing wrong? Thanks for your help in advance, Mike __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php