logo       

Next, prev links: msg#00242

php.tcphp

Subject: Next, prev links

Hi,
I am trying to figure out a more optimal way to do next, prev links. I have this
working as described below, but it doesn't seem efficiant and there may be a
cool mysql feature to do this I do not know of.

Does anyone have a quick sneaky method for generating the next, previous urls
for <link> tags given that ids are indirectly part of the url and sorting may
apply.

For example the urls are in the form of ...
http://example.com/gallery/image_4543654_sort_newest.html

>From this I would be able to generate a query like
SELECT * FROM gallery WHERE id = 4543654

Now, I would like to have next and prev <link> tags to the header and in the
page. But, sorting may apply. In theory we know the sorting. So, the method I
have been doing all along is getting all items sorted accordingly, finding the
index $i of current one, then then also selecting $i-1 and $i+1.

Anyone know of a better way to do this. I really don't want to select all of the
items just to get the next and previous. It seems this info would be available
on the mysql server side and be easy to retrieve. Maybe even some crazy use of
LIMIT 3 centering around the current one, or something like that.

Any thoughts?







--
Blaine Garrett
Chief Web Applications Developer
JR Computer Associates INC
http://jrcorps.com
blaine-4hELYU93S8xBDgjK7y7TUQ@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx

Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines

The tcphp.org mailing list is sponsored by pajunas interactive, inc.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise