Thank you all for your input. Here is the answer that I was looking for. I am posting it here so that anyone else looking for this answer can benefit as well.
Thank you all again for your responses. Merry Christmas!! William ----- Original Message ----- From: "Jay Blanchard" <[EMAIL PROTECTED]> To: "'William Martell'" <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 6:03 AM Subject: RE: Paging / Navigation Question > [snip] > > [snip] > Or another way if you don't want a result when it's zero. > $rslt = mysql_query("SELECT count(*) as cnt FROM tbl having cnt > 0"); > [/snip] > > $result = mysql_query("SELECT * FROM tbl"); > $number_of_rows = mysql_num_rows($result); > > You don't have to do the count in the SQL, as John said earlier a SELECT > COUNT(*) FROM tbl will always return one row, even if the value of the row > is 0. Of course you could always test for that. > > CountingRows Solution #317 :^] > > I was reading your post regarding paging and SELECT COUNT(*) > > I don't understand why $number_of_rows will always equal 1. > > I thought that if you SELECT COUNT(*), that you are telling mySQL to count > all of the rows WHERE some condition is met. > > Please explain??? > [/snip] > > A COUNT query always returns one row, the row which explains how many > records were counted. It is easier to understand if you know that a row is > not necessarily equal to a record. For example, look at these count results > from MySQL monitor; > > mysql> SELECT COUNT(*) FROM tblSubscriber; > +----------+ > | COUNT(*) | > +----------+ > | 71896 | > +----------+ > 1 row in set (0.01 sec) > > See the last line? "1 row in set (0.01 sec)" Of course this is not a record, > for the record would have subscriber information over multiple columns. > > Let me know if this is clear. > > Thanks! > > jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php