http://666kb.com/i/c6e4rv80gz9yrn9h5.png
Check out my image, I limited the query for just 5 entry but it returns with 9 rows? What is the problem, I could not get it.
With mysql, the LIMIT
parameters are offset, row_count
, but the first parameter is optional - crazy, but true!
So when you have two parameters, the first is the starting row, the second is the number of rows.
You asked for LIMIT 5, 10
which means 10 rows, starting from row 5 (not rows 5 to 10).
You are not the first, and you won't be the last, person to be confused by this.
In MySQL Limit function Syntax are:
SELECT column_name(s)
FROM table_name
LIMIT Rows start , Quantity of Rows for display;
Example:
SELECT *
FROM customer
LIMIT 2 , 10;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With