Smart previous and next buttons

Hi

I was wandering how do you disable the previous and nest buttons if there is no more page to browse?

I managed to create the next and previous buttons to browse, however I don’t know how to disable them if no more page to browse.

This is the code:



if ( $_GET['start'] && $_GET['limit'] ) {
  $start = $_GET['start'];
  $limit = $_GET['limit'];
} else {
  $start = 0;
  $limit = 4;
} 


  
$query = "SELECT id, msg, subject, DATE_FORMAT(date, '%M %D, %Y') as formatted_date, TIME_FORMAT(time, '%l:%i:%p') as timeNow FROM blog ORDER BY id DESC LIMIT $start, $limit";
  $query_result = mysql_query($query); 
    
    while ($row = mysql_fetch_array($query_result)) {
        $formatted_text= nl2br($row[msg]);
        $content .="
            <div class=\"blogLC\">
                <div class=\"blogLCReplyC2\">$row[subject]
                <div class=\"blogLCReplyDetail\">
                    Posted by Ivan | $row[formatted_date] | $row[timeNow]<br><br>
                                    
                </div>
            </div>
                            
            <div class=\"blogReplyMessages\">
                $formatted_text
            </div>
                            
<div class=\"blogReplyOptions\"><a href = \"detail_blogs.php?topic_id=$row[id]\"><img src=\"images/read.jpg\" border=\"0\"> <a href = \"reply.php?topic_id=$row[id]\"><img src=\"images/reply.jpg\" border=\"0\"></a></div>
            ";
    
        
};
 
 $nextLink = "view_blogs.php?start=" . ($start+4) . "&limit=" . ($limit+0);
$backLink = "view_blogs.php?start=" . ($start-4) . "&limit=" . ($limit-0); 
 
$content .= "
    <div class=\"blogNavSystem\">
<a href=\" " . $backLink . " \">Previous Page</a>&nbsp; &nbsp; | &nbsp; &nbsp; <a href=\" " . $nextLink . " \">Next Page</a></div>";