0
how to make a query, searching data from the given ID?
For example, my table has 1 thousand records, I want to determine in a foreach the search of the data from the record 300.
0
how to make a query, searching data from the given ID?
For example, my table has 1 thousand records, I want to determine in a foreach the search of the data from the record 300.
4
From what I understand you would like to pick up records at a range, you could be using for example the OFFSET
and LIMIT
SELECT coluna FROM tabela ORDER BY id LIMIT 10 OFFSET 10;
In this case, you can use the OFFSET
to determine the starting id and the LIMIT
to determine how many records you want.
The above example will return the id’s from 11 to 20.
I hope I’ve helped.
Reference:
http://www.w3schools.com/php/php_mysql_select_limit.asp https://dev.mysql.com/doc/refman/5.7/en/select.html
Exact. In your question Voce confuses the ID, which is usually related to a primary key, with a record position indicator, or a cursor.
Browser other questions tagged php sql query
You are not signed in. Login or sign up in order to post.
I don’t think an answer fits, that question must have duplicate,
SELECT * FROM tabela WHERE id > 300
– MarceloBoni
Possible duplicate of Select with date over 20 years @Marcelobonifazio
– Florida