Yo Evan,

Have you got an '@' in front of the mysql_query() to supress errors ?

Evan Morris wrote:

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

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
// do some other stuff

However, this gives me: "Supplied argument is not a valid MySQL result

If I go: echo "$result", I get '1', so I know $result actually has some

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
Tel: +27 11 792 2777
Fax: +27 11 792 2711
Cell: +27 82 926 3630

=============Disclaimer and Confidentiality===================
This message contains information intended for the perusal, and/or use (if so stated), by the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon  he information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. ======================================================

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to