Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

skip/bypass data on A mysql_query

Tags:

php

mysql

I'm working on some charts and I need to find out how I can make my query skip x records on a select.

Lets say, I have 100 Records in my MySQL database.
and I want to select, but buypass 9, or skip 9 (whatever we should call it)..
so I'm selecting:
id 1
id 10
id 19 etc etc..

How am I able to do so in a query ?

I have tried to get the values in a for loop by incrementing $i with $offset (how many I want to bypass) and then use the $data[$i]['value']; but is was not able to get that to work.

like image 642
Mads Andersen Avatar asked Dec 03 '25 03:12

Mads Andersen


1 Answers

Try something like

Select * from foo where id%9=1
like image 51
Carsten Massmann Avatar answered Dec 04 '25 16:12

Carsten Massmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!