RE: [PHP] next page records (done, but a little problem. -OT-)
| From: | John W. Holmes | Date: | Sat, 03 May 2003 01:28:18 +0000 |
| Subject: | RE: [PHP] next page records (done, but a little problem. -OT-) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146219@lists.php.net to get a copy of this message | ||
Yeah? Are you getting a value back for $total_rows? What is it? Check
your math later in the page where you determine what to show... I didn't
really look at that code; I was just showing you how to get the count...
which you asked for.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: Ryan A [mailto:ryan@jumac.com]
> Sent: Friday, May 02, 2003 9:08 PM
> To: holmes072000@charter.net; php-general@lists.php.net
> Subject: Re: [PHP] next page records (done, but a little problem.
-OT-)
>
>
> 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/
> >
> >
> >