On Thu, Oct 23, 2003 at 03:51:30PM -0700, Mike Alderson wrote:
:
: 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());
Are you sure your query succeeded before you entered your while loop?
: 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());
: }
:
: ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php