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);

 I have loaded a book into the tabel called "books". I have gave each
section a nodeid and each book a bookid. SO i wanted to get number of
distinct nodeid's (i.e. sections) in the book so that i could use a for loop
to display all of them and an inner for loop to display each page under each
section.
  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.
 By the way the web hoster i am using has PHP Version 4.0.6 .
  Thanks.
Gurhan

-----Original Message-----
From: Richard S. Crawford [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 2002 3:01 PM
To: Gurhan Ozen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql_num_rows


It would help if we could see the actual query.  It sounds like the problem
is a syntax error in the query itself.

At 11:52 AM 1/6/2002, Gurhan Ozen wrote:
>   Hi everyone,
>  I have a problem with mysql connectivety which is making me nuts. If the
>query is "select blah, blah from table" (i.e. without where clause)
>mysql_num_rows returns the right number, but when i put in a query with
>where clause, although there are rows returned, PHP is giving:
>"Warning: Supplied argument is not a valid MySQL result resource" error..
>Can anyone point me to any direction about this?
>   Thanks.
>
>Gurhan
>
>
>--
>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]


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"


--
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]



--
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