mysql queries + pagination

This is a discussion on mysql queries + pagination within the PHP General forums, part of the PHP Programming Forums category; apoogies if this is not posted in the best place. i have two tables, companies and websites. each web seite ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-27-2006
cruiserweight
 
Posts: n/a
Default mysql queries + pagination

apoogies if this is not posted in the best place. i have two tables,
companies and websites. each web seite is categorized by design type
(flash, xhtml, etc). what i am trying to do is previous/next links to
go through a category. yet i have no idea how to even begin...

if i select * where category ='flash', for example, how could i
identify the next and prev row from that selection, or where siteId =
'5' is in the list. thanks in advance.

Reply With Quote
  #2 (permalink)  
Old 08-28-2006
weetat.yeo@gmail.com
 
Posts: n/a
Default Re: mysql queries + pagination

Hi ,

Use Pear:Paging library, it quite good.
search php.pear.net for more info


cruiserweight wrote:
> apoogies if this is not posted in the best place. i have two tables,
> companies and websites. each web seite is categorized by design type
> (flash, xhtml, etc). what i am trying to do is previous/next links to
> go through a category. yet i have no idea how to even begin...
>
> if i select * where category ='flash', for example, how could i
> identify the next and prev row from that selection, or where siteId =
> '5' is in the list. thanks in advance.


Reply With Quote
  #3 (permalink)  
Old 08-28-2006
mootmail-googlegroups@yahoo.com
 
Posts: n/a
Default Re: mysql queries + pagination

cruiserweight wrote:
> apoogies if this is not posted in the best place. i have two tables,
> companies and websites. each web seite is categorized by design type
> (flash, xhtml, etc). what i am trying to do is previous/next links to
> go through a category. yet i have no idea how to even begin...
>
> if i select * where category ='flash', for example, how could i
> identify the next and prev row from that selection, or where siteId =
> '5' is in the list. thanks in advance.


You could use the LIMIT clause in your sql statement.
Proper syntax: LIMIT <offset>, <rows>
So, by saying, for example LIMIT 50, 25, would give you a resultset
starting at row #50 of the results, and giving you the next 25 records.

I can't really tell from your question if you are displaying each
category one-per-page, or multiple categories per page. This concept
would apply equally well to both situations, however. Just keep track
of what # category you are currently on, and use LIMIT <# of current
category>, 1

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:22 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0