Re: Paging / Navigation Help
| From: | 1LT John W. Holmes | Date: | Thu, 12 Dec 2002 20:15:37 +0000 |
| Subject: | Re: Paging / Navigation Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128058@lists.php.net to get a copy of this message | ||
Ummm... because that's exactly what you're asking for. Look over your code
again. COUNT(*) returns one record in one column, one row.
---John Holmes...
----- Original Message -----
From: "William Martell" <willmartell@yahoo.com>
To: "phplist" <php-list@yahoogroups.com>; <php-general@lists.php.net>;
"beginning_php@p2p.wrox." <beginning_php@p2p.wrox.com>; <yomama@ucsd.edu>;
<dvm@gwtr.com>; <robleyd@paradise.net.nz>; <maxmouse@maxmouse.org>
Sent: Thursday, December 12, 2002 2:56 PM
Subject: [PHP] Paging / Navigation Help
> Hello ALL.
>
> Can anyone tell me why the number of rows is always 1 and count is the
total
> number of records in my database.
>
> Thanks in Advance,
> William
>
> [snip]
>
> <HTML>
> <HEAD>
> <TITLE></TITLE>
> </HEAD>
>
> <BODY>
>
> <?php
>
>
> $db = mysql_connect("localhost", "root");
>
> mysql_select_db("dallas", $db);
>
> $result = mysql_query("SELECT COUNT(*) as count FROM partscatalog having
> count >0;",$db);
>
> //get number of rows returned
> $number_of_rows = mysql_num_rows($result);
>
> if ($number_of_rows != '0')
> {
> while ($myrow = mysql_fetch_array($result))
> {
> echo "\$number_of_rows is $number_of_rows";
> echo "count: ".$myrow["count"]."<br>\n";
>
> }
> }
>
> ?>
>
> </body>
> </html>
>
>
> [/snip]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>