MySQL Forums
Forum List  »  PHP

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
Posted by: Eric Mestreau
Date: August 19, 2005 02:26PM

I ma getting a problem running MySQL/php (4.4.0) on a windows PC.

Here are the folllowing lines of code generating the problem:

$journalserver = "saicjournal.local";

# FileName="database Connection file"
# Type="MYSQL"
# HTTP="true"
$hostname_journaldb = "localhost";
$database_journaldb = "saicjournaldb";
$username_journaldb = "saicuser";
$password_journaldb = "cal1tap8t";
$journaldbuser = mysql_pconnect($hostname_journaldb, $username_journaldb, $password_journaldb) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database_journaldb) or die('failed to select database');

function send_query($qry)
{
global $journaldbuser;
$qry_rs = mysql_query($qry, $journaldbuser) or die(mysql_error());
$nbr_rs = mysql_num_rows($qry_rs);
return array($qry_rs,$nbr_rs);
}

$v1 = send_query("delete from project_tbl where project_id=1");

------------------------------------------------------------------------

The table, database connection and running the delete query works perfectly except for the mysql_num_rows line which returns the warning <mysql_num_rows(): supplied argument is not a valid MySQL result resource>. I know this type of warning may be due to a bad query.
I have not been able to find any problem to the query. The deletion query is also properly executed. I checked using the php admin tools.

I would appreciate any help as this is show stopper as I need to check if the query was properly performed.

Thanks

Eric

Options: ReplyQuote


Subject
Written By
Posted
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
August 19, 2005 02:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.