php博客分页排名

i am still a novice in PHP. please i need help. i am creating a blog page with pagination and i want the ranking to descend start from the last "id" from my database table not from the first "id" so that if i add a new post to my database, it will display at the top of my blog page. here is my coding:

    <?php


$per_page = 5;

if(!isset($_GET['page'])){
    $page = 1;
} else {
    $page = $_GET['page'];
}

if($page<=1)
$start = 0;
else
    $start = $page * $per_page - $per_page;

include 'connect.php';

$sql = "SELECT * FROM pagination";

$num_rows = mysql_num_rows(mysql_query($sql));

$num_pages = ceil($num_rows / $per_page);



$sql .= " LIMIT $start, $per_page";

$result = mysql_query($sql);
While($row = mysql_fetch_array($result)){
    echo $row['name']. "<br>";
}

$prev = $page - 1;
$next = $page + 1;

echo "<hr>";

if($prev > 0)
echo "<a href='?page=$prev'>Previous</a> ";

if($page < ceil($num_rows/$per_page))
echo " <a href='?page=$next'>Next</a>";


?>

and same with my comment page, i want the last comment to display first. here is my coding:

<?php

include 'connect.php';

function getuser($id, $field) {
    $query = mysql_query("SELECT $field FROM suggest WHERE id='$id'");
    $run = mysql_fetch_array($query);
    return $run[$field];
}

$readq = mysql_query("SELECT id FROM suggest");
while($run_p = mysql_fetch_array($readq)){
    $id = $run_p['id'];
    $name = getuser($id, 'name');
    $title = getuser($id, 'title');
    $post = getuser($id, 'post');

?>
<table width="60%">
<tr>
<td><b><font color="blue"><?php echo $title; ?></font><br><br><?php echo $post; ?><br>Suggestion From: <font color="blue"><?php echo $name; ?></font></b><hr width="50%"></td>
</tr>
</table>
<?php
}
?>

SELECT column_name, column_name
FROM table_name
ORDER BY column_name ASC|DESC

you can use the ORDER BY column_name ASC or DESC in you query to display it the ways you want.

</div>

For latest records you need to use ORDER BY DESC in your query.

You can be use this query:

SELECT id FROM suggest

Like that:

SELECT id FROM suggest ORDER BY id DESC

Side note: i suggest to use mysqli_* or PDO because mysql_* is deprecated and closed in PHP 7.