|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Virtual Tradeshows by Ziff Davis Enterprise – A Unique Opportunity to Interact with IT Experts, Access Information, and Gain Insight on Today’s Trends in Technology Learn more
|
|
#1
|
|||
|
|||
|
I wish to use mySQL to display data n records at a time similar to the way it is done on search engines. Once I display the 1st n records, I want to be able to provide a link to the 2nd n records. Right now, the only way I know to do this is to execute the query grabbing all records and to use a while or for loop to only grab the 2nd set of n records. Is there a smarter, less memory-intensive way to do this.
------------------ T e c h 9 M u l t i m e d i a www.tech-9.com URL |
|
#2
|
|||
|
|||
|
you can use a LIMIT offset, rows with your select statement. i use this all of the time and it works great. All you need to do is keep track of the last offset. The rows variable is the number you return and presumably that will stay the same.
ie. first time: SELECT * from table_name LIMIT 0,12; second time: SELECT * from table_name LIMIT 12,12; |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Displaying data n records at a time |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|