Re: next page records (done, but a little problem. -OT-)
| From: | Ryan A | Date: | Sat, 03 May 2003 01:08:20 +0000 |
| Subject: | Re: next page records (done, but a little problem. -OT-) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146217@lists.php.net to get a copy of this message | ||
Hi John,
thanks for replying.
Using the code you gave me I am getting the EXACT output of when i
experimented with it....
its not outputting any page numbers and no "NEXT" only "PREV"
Check it out at http://securecents.com/instant2c/normal/Admin/view2.php
login is:
admin/testing
Kindly reply.
Cheers,
-Ryan
> > Thanks to the links given to me by the kind people here I have
> findished
> > "paginating" one of my scripts...I just have one little problem,
> instead
> > of
> > using "COUNT" this method is using "mysql_num_rows" as you can imagine
> if
> > you have a large amount of records this is not a good solution but
> somehow
> > I
> > am unable to implement "COUNT" into this so I am includeing the code
> below
> > in its original form for any suggestions from you guys.
> > How can i take out the mysql_num_rows and add "count" instead?
> [snip]
> > $query_count = "SELECT * from $tcname";
> > $result_count = mysql_query($query_count);
> > $totalrows = mysql_num_rows($result_count); // **** this is
> what i
> > want to take out and put "count()"
>
> $query_count = "SELECT COUNT(*) FROM $tcname";
> $result_count = mysql_query($query_count);
> $total_rows = mysql_result($result_count,0);
>
> or
$query_count = "SELECT COUNT(*) FROM $tcname";
$result_count = mysql_query($query_count);
$row = mysql_fetch_row($result_count);
$total_rows = $row[0];
> or
>
> $query_count = "SELECT COUNT(*) AS c FROM $tcname";
> $result_count = mysql_query($query_count);
> $row = mysql_fetch_assoc($result_count);
> $total_rows = $row['c'];
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>