Click to See Complete Forum and Search --> : MySQL functions didn't work


UQKdk
12-23-2002, 07:08 AM
Why didn't MySQL functions like mysql_num_rows() not work with PHP4?
I have found the same problem questioned before on phpbuilder, link: http://www.phpbuilder.com/board/showthread.php?threadid=10221045&perpage=15&highlight=mysqlnumrows&pagenumber=1

But I don't understand how he fixed it, can someone help me?, the error massage is:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in [the file] line [the line]

Is there another way to test how many results there are found in a mysql_query?

Start of code:

$result = mysql_query('select * from database');
while ($row = mysql_num_rows($result))
{
}

:End of code

Thanks UQKdk

planetsim
12-23-2002, 08:22 AM
on the query put a or die(mysql_error());

lnfreish
12-30-2002, 06:52 AM
have you use mysql_connect() to connect your Mysql host before you perform the mysql_query()?

UQKdk
01-01-2003, 11:42 AM
Thanks both! It works...