Hi all
I have successfully managed to connect to the mysql database, using the
following code:
mysql_connect('localhost','php','*******') || die ("Unable to connect to
MySQL server.");
$db = mysql_select_db("DB_NAME") || die ("Unable to select requested
database.");
I then issue the following command:
$result = mysql_query("SELECT * FROM SOME_TABLE") || die(mysql_error());
This does not result in any error.
Now, of course, I want to work with the data returned, so I go:
if (mysql_num_rows($result) > 0)
{
// do some stuff
}
else
{
// do some other stuff
};
However, this gives me: "Supplied argument is not a valid MySQL result
resource."
If I go: echo "$result", I get '1', so I know $result actually has some
value.
What am I doing wrong? Basically, I want to do the simplest thing: get data
out of a table and step through the results, displaying them one by one. Why
is this hard?
Evan Morris
[EMAIL PROTECTED]
Tel: +27 11 792 2777
Fax: +27 11 792 2711
Cell: +27 82 926 3630
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php