Actually, I didn't think of that. That may work.

Thank you, Mr. Williamsen and Mr. Cox for your suggestions. I will try out
both solutions.

----- Original Message -----
From: "Todd WIlliamsen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 12, 2002 10:09 PM
Subject: Re: [PHP-DB] Flipping through database records


> how about just not do it by userid?  query some other column thats in
there
>
> maybe by last name?
>
> SELECT * FROM $tablename WHERE lname = $lname LIMIT [#results per page]
>
> That should eliminate gaps
> "Olinux" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Interesting Jason, just to make sure I'm clear:
> >
> > basically, you would query the table and
> > while loop through the query result and create an
> > array and then store that in a session?
> >
> > olinux
> >
> >
> > --- Jason Cox <[EMAIL PROTECTED]> wrote:
> > > Dan,
> > >
> > > Here's an idea for you:
> > >
> > > Rather than try to pass the uid through the pages,
> > > pass a counter that will
> > > act as an index to your result array.  For example,
> > > let's say you have a
> > > query like: select * from myTable order by someCol;
> > > The order by will help
> > > give some sort of uniformity to the list on each
> > > page.  Each time you access
> > > the page, you would run this query and stuff
> > > everything into an array.  The
> > > index would be passed in and indicate which record
> > > in the array to display.
> > > You would know whether to display the 'prev' and
> > > 'next' labels by comparing
> > > the index to the size of the array.
> > >
> > > If your table is large than you can optimize your
> > > query so you're not
> > > returning all the rows everytime.  If the index was
> > > $idx then you could do
> > > something like: select * from myTable order by
> > > someCol limit $idx;  So if
> > > you had a hundred records and your index was 10 then
> > > you would only get the
> > > first 10 records.  Since we're including the order
> > > by clause, the 10 should
> > > pretty much stay the same if the table doesn't
> > > change very often.  With this
> > > technique you would need to do a count() to find out
> > > the maximum number rows
> > > in the table.  Since a count() is faster than a
> > > query returning many rows,
> > > the combination of these two statements would be a
> > > bit faster than running
> > > the original query on a large table.  But then
> > > again, on a large table I
> > > doubt someone would want to browse each row.  That's
> > > kinda like looking for
> > > a good book by browsing the card catalog at the
> > > library... :)
> > >
> > > Hope that helps,
> > > Jason Cox
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to