don't know if this makes a difference, but i've always used WHERE bookid =
'$bookid'"; - single quote round the $bookid variable - not sure if that's
the problem, or if it's just good practice?

-----Original Message-----
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]]
Sent: 08 January 2002 14:07
To: 'Gurhan Ozen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql_num_rows


> -----Original Message-----
> From: Gurhan Ozen [mailto:[EMAIL PROTECTED]]
> 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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.312 / Virus Database: 173 - Release Date: 31/12/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.312 / Virus Database: 173 - Release Date: 31/12/01
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to