Re: Problem with a query? or Syntax?
| From: | Chris Hayes | Date: | Thu, 16 Aug 2001 21:00:36 +0000 |
| Subject: | Re: Problem with a query? or Syntax? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63103@lists.php.net to get a copy of this message | ||
> $num_de_rows = mysql_num_rows ($r);
> this line <- if ( $num_de_rows > 0 ) { (i create some html
> tables here) }
> The error im getting is:
> Warning: Supplied argument is not a valid MySQL result resource in
> /home/passive-/public_html/pic_archive.php on line 172
I am not sure but have some ideas where to look.
Can you echo/print the value $num_de_rows? It could be that it is 'false' or
empty, and maybe php chokes on the comparison ? [ if (false>0) or (>0) ]
then test add in the if a test whether the $num_de_rows is false/empty.
Would it be an idea to set $num_de_rows to 0 before you start? Nahh...
wouldn't help.
Also try to print/echo the query and run the query on your database in
phpmyadmin and see if the resulting table is what you expected.
<obscure>
could it be that line 172 also contains a part of the html table printing?
i think the numbering of the $r array starts with index 0 so there is no
$r[1] if the number of rows is 1. Just $r[0].
</obscure>
hth,
Chris
--------------------------------------------------------------------
-- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands --
--------------------------------------------------------------------