Jump to content

[SOLVED] SELECT FROM table ... skipping values


proggR

Recommended Posts

Without adding a second ID to determine the entry number based on another column, is there anyway to skip a certain number of values based on which page is selected? I'll have keywords setup saved in the column 'keyword' and i want to SELECT FROM table WHERE keyword='Something'   

But if its page one i want it to take the first 5 entries that fit that description and if its page 2 i want it to select the next 5 etc. Is there anyway to do this quickly? I have a few ideas but I want to know if I'm putting too much work into it :P

Thanks in advance.

 

I am not 100% sure I get what you are saying, but what I think you want to use is LIMIT

 

So for page one you would do  SELECT whatever FROM table WHERE keyword='Something' LIMIT 5

This will return only the first 5 results

 

For second page you would do

SELECT whatever FROM table WHERE keyword='Something' LIMIT 5,5  This will start at the 6th row and return the next 5 rows..

So row 6-10

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.