I am using a PHP / MySQL pagination script which works fine, however I have trouble sorting the output accordingly.
Here parts of my script:
$link=mysql_connect("localhost","x","x");
mysql_select_db("x",$link);
$q="select count(*) \"total\" from entries";
$ros=mysql_query($q,$link);
$row=(mysql_fetch_array($ros));
$total=$row['total'];
$dis=3;
$total_page=ceil($total/$dis);
$page_cur=(isset($_GET['page']))?$_GET['page']:1;
$k=($page_cur-1)*$dis;
$q="select * from entries limit $k,$dis";
$ros=mysql_query($q,$link);
while($row=mysql_fetch_array($ros))
{
I've tried to change the line
$q="select count(*) \"total\" from entries";
to
$q="select count(*) \"total\" from entries id DESC";
however it does not seem to be working correctly.
Anyone has an idea how I can get this fixed and have the items sorted by ID?
Some expert help would be greatly appreciated - thank you very much.
Please find the original script I have in place here: http://allitstuff.com/php-mysql-pagination-script-download/