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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.