A key to understanding your mysql errors is by using the mysql_error() function. It's wonderful! Here's a simple example with a little error checking:
<?php error_reporting(E_ALL); $conn = mysql_connect('host','user','pass'); if (!$conn) { print "Could not connect to mysql : " . mysql_error(); exit; } mysql_select_db('dbname'); $sql = "SELECT foo,bar FROM blah"; $result = mysql_query($sql); // mysql_query returns false on failure. if (!$result) { print "Could not query DB ($sql) : " . mysql_error(); exit; } while($row = mysql_fetch_assoc($result)) { extract($row); print "Hello $foo, I like $bar too\n"; } ?> Regards, Philip Olson On Sun, 19 May 2002, Justin Latham wrote: > I am trying to clone my webserver because I am switching ISPs. So I copied > the MySQL database, and then I copied the php pages. But my new server > insists that any query I do is not a valid result resource when I try to use > it in a mysql_fetch_array command. I know that both php and the database > are functional (to an extent) because all other commands work. > I'm using PHP 4.something over MySQL 3.2.3 running RedHat 7.0. > Thanks > > Justin > > > > -- > 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