On selecting the data from MySQL if we are required to limit the data but also it is needed to start from some offset only not from the first record, then there we can add OFFSET in the clause of the query.
Lets take an example where we required 10 records from offset 10 i.e.,from 11th record
$sql = "SELECT * FROM EMP LIMIT 10 OFFSET 10";
In the above the limit is of 10 and the offset is set to 10th record i.e., it starts from 11th one.
Note : In shorthand method we can write it as :
$sql = "SELECT * FROM EMP LIMIT 10, 10";
0 Comment(s)