Re: mysql_num_rows
| From: | bill | Date: | Tue, 08 Jan 2002 15:23:25 +0000 |
| Subject: | Re: mysql_num_rows | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15534@lists.php.net to get a copy of this message | ||
Drop the "$result" from the mysql_num_rows() so it reads:
$num_results=mysql_num_rows();
Depending upon the PHP version, that might do the trick for you.
kind regards,
bill
Mike Ford wrote:
> > -----Original Message-----
> > From: Gurhan Ozen [mailto:c-gurhan.ozen@wcom.com]
> > Sent: 06 January 2002 20:10
> >
> > I am pretty sure that the query is correct. here is the actual query:
> > $query="select distinct(nodeid), nodename
> > from books where
> > bookid=$bookid";
> > $result=mysql_query($query);
> > $num_results=mysql_num_rows($result);
> >
> <snip>
> > The funny thing is that if i write the same query without "where
> > bookid=$bookid" then the mysql_num_rows works but with where
> > statement it
> > doesn't.
>
> Have you echoed $result to see what it contains? My guess is that it contains something
> unexpected which, when inserted into the query, causes it to fail (or at least return no rows!).
> Otherwise, I can see no reason for the addition of the WHERE clause to cause this error.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.ford@lmu.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211