Jump to content

Selecting rows before and after an ID


Chris Hansen

Recommended Posts

Hi

 

I need to select the rows before and after a specified row.

 

If my database looks like:

 

ID

100

101

103

111

120 - The specified id

180

190

200

201

 

ID 120 is specified and I want to retrieve the 4 rows before and after that row (the green ones).

 

How can this be done in PHP?

 

Thanks for any help and I hope it makes sense,

Andy

Link to comment
https://forums.phpfreaks.com/topic/170146-selecting-rows-before-and-after-an-id/
Share on other sites

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.