I'm currently having trouble integrating the page variable and id variable into display.php so originally; display.php will show all the posts with 3 entries on each page with the pages (http://domain.com/display.php?p=1) but when you click on the entry name in the archive, it will only show that entry (http://domain.com/display.php?p=&id=1) I'm still a novice so I think i messed up my display.php pretty bad >.>

I already tried searching the forum but there were only solutions where the pagination tutorial was found in other sites and isn't distinctly associated with BAB.
CODE
<?php
    
    mysql_connect ('host', 'user', 'pass');
    mysql_select_db ('database');
    
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        die("Invalid ID specified.");
    }
    $id = (int)$_GET['id'];
    $sql = "SELECT * FROM chronicle WHERE id='$id' LIMIT 1";
    
    $blog_postnumber = 3;
    if(!isset($_GET['p'])) {
        $p = 1;
    } else {
        $p = (int)$_GET['p'];
    }
    $from = (($p * $blog_postnumber) - $blog_postnumber);
    if($_GET['p'] == "") {
        $type = "";
    } else {
        $type = $_GET['p'];
    }
    $sql = "SELECT * FROM chronicle ORDER BY timestamp DESC LIMIT $from, $blog_postnumber";
    $result = mysql_query($sql) or print ("Can't select entry from table chronicle.<br />" . $sql . "<br />" . mysql_error());
    while($row = mysql_fetch_array($result)) {
        $date = date("F d, Y", $row['timestamp']);
        $comment = ($row['timestamp']);
        $title = stripslashes($row['title']);
        $entry = stripslashes($row['entry']);
        echo "<h2>$title</h2>\n<h4>Written on $date • <a href=\"java script:HaloScan('$comment');\" target=\"_self\"><script type=\"text/javascript\">postCount('$comment');</script></a></h4>\n<div class=\"content\">$entry</div>\n";
    }

?>
<div class="pages">
<?php

    $total_results = mysql_fetch_array(mysql_query("SELECT COUNT(*) AS num FROM chronicle"));
    $total_pages = ceil($total_results['num'] / $blog_postnumber);

    if ($p > 1) {
        $prev = ($p - 1);
        echo "<a href=\"index.php?p=$prev\">Previous</a> ";
    }

    if ($p < $total_pages) {
            $next = ($p+ 1);
           echo "<a href=\"index.php?p=$next\">Next</a>";
    }

?>
</div>