Use LIMIT .
SELECT *
FROM redirect
WHERE user_id = '35251'
ORDER BY timestamp
LIMIT 40, 10
40 - how many records to skip, 10 - how many are displayed.
There are also a few problems with your PHP. You use backticks (not single quotes) to surround table and column names. And you should not use string concatenation to create a query.
source
share