tags:

views:

52

answers:

2

For example, $x1 = 10, $x2 = 25 then it will work Limit $x1, $x2. But I want to make Limit $x2, $x1 and it doesn't work. I want to get from newest to oldest entry from that list. ORDER BY doesn't work

edited you can close it, I've figured out by myself. I use

ORDER BY a_time DESC LIMIT $x2-$x1

now, so thanks.

A: 

Just ORDER BY key DESC;

Then get end of the list. $count-$x2

MindStalker
I had done it before but it didn't work.
hey
+1  A: 

To select the first 10 rows...

SELECT * FROM customer ORDER BY id ASC LIMIT 0, 10

To select the last 10 rows....

SELECT * FROM customer ORDER BY id DESC LIMIT 0, 10

This tells the script to start at 0, then count 10 rows. This is the best/most efficient way of doing this.

Webnet