tags:

views:

29

answers:

1

How do you make a query which gets data and lists it from the last entry in order of the ID adding it onto the code shown below,

Example which needs add on,

$data_table = "posts";
$per_page = 8;
$start = $_GET['start'];
$query = mysql_query("SELECT *
                        FROM $data_table 
                       LIMIT $start,$per_page") or die(mysql_error());

Any code examples and Information would be useful, thanks.

+2  A: 

You need to specify an ORDER BY clause:

$query = mysql_query("SELECT *
                        FROM $data_table 
                    ORDER BY id DESC
                       LIMIT $start,$per_page") or die(mysql_error());

If there's no ORDER BY clause, there's no guarantee about data order.

OMG Ponies