LeeTee LeeTee - 1 month ago 7
MySQL Question

PHP / MYSQL error: mysql_num_rows(): supplied argument is not a valid

I have the following code:

$sql = mysql_query("SELECT id FROM logins WHERE id='" . $this->skID . "'");

if(mysql_num_rows($sql) == 0) { return false; }
else {
list($skID) = mysql_fetch_row($sql);
return $skID;
}


which brings back the below error.


mysql_num_rows(): supplied argument is not a valid MySQL result
resource


I have echoed out the SQL and run this in the database and I get a result, so what the problem - any ideas most welcome?

[EDIT] Sorry Im being an absolute idiot, trying to use mysql functions on an ms database! Sorry!

Luc Luc
Answer

have you checked that your connection has been established. perhaps try outputting the query results after your query. also try to echo your mysql_error() to see if anything went wrong.

echo mysql_error();

straight after your query.

Comments