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_q开发者_StackOverflow社区uery("SELECT *
FROM $data_table
LIMIT $start,$per_page") or die(mysql_error());
Any code examples and Information would be useful, thanks.
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.
精彩评论