Jump to content

how to display 15 results, then a new page?


mATOK

Recommended Posts

Hi, I would like to modify the following code so that I output the first 15 results, then build a new page for the next 15 and so on. I would also like to have a link at the bottom that shows like page numbers and arrows back and forth.

I guess firstly I need to know how to output only 15 and then build a new page if necessary.

[code]
$eventid=$_POST['eventid'];
$section=$_POST['section'];
$note1=$_POST['note1'];
$note2=$_POST['note2'];
if (!$sort) {
        $q="SELECT * FROM print_notes ORDER BY effective_date DESC";
}
if (!strcmp($sort, 'date')) {
        $q="SELECT * FROM print_notes ORDER BY date DESC";
}
elseif (!strcmp($sort, 'edate')) {
        $q="SELECT * FROM print_notes ORDER BY effective_date";
}
elseif (!strcmp($sort, 'class')) {
        $q="SELECT * FROM print_notes ORDER BY class";
}
elseif (!strcmp($sort, 'company')) {
        $q="SELECT * FROM print_notes ORDER BY company";
}
elseif (!strcmp($sort, 'media')) {
        $q="SELECT * FROM print_notes ORDER BY media";
}

$rez=mysql_query($q) or die (mysql_error());
if (mysql_num_rows($rez) == 0){
        echo "<p>Currently there is no print notes</p>";
}
else {
        while ($i = mysql_fetch_array($rez)) {


                                $img = $i['file'];
                                echo "<table border=\"1\" width=700 style=\"border-collapse:collapse\" align=\"center\">";
                                echo "<tr><th class=\"pnotes\">Date</th><td class=\"pnotestd\">".$i['date']."</td>";

                                if ($path == $i['file']) {
                                        echo "<td rowspan=\"9\" align=\"center\">NO IMAGE TO DISPLAY";
                                        echo "</td></tr>";
                                }
                                else {
                                        echo "<td rowspan=\"9\" align=\"center\"><a href=".$i['file']." target=_blank>";
                                        echo _imgResize($img, "225");
                                        echo "</a></td></tr>";
                                }
                                echo "<tr><th class=\"pnotes\">Effective Date</th><td class=\"pnotestd\">".$i['effective_date']."</td></tr>";
                                echo "<tr><th class=\"pnotes\">Issue</th><td class=\"pnotestd\">".$i['issue']."</td></tr>";
                                echo "<tr><th class=\"pnotes\">Class</th><td class=\"pnotestd\">".$i['class']."</td></tr>";
                                echo "<tr><th class=\"pnotes\">Company</th><td class=\"pnotestd\">".$i['company']."</td></tr>";
                                echo "<tr><th class=\"pnotes\">Media</th><td class=\"pnotestd\">".$i['media']."</td></tr>";
                                echo "<tr><th class=\"pnotes\">Instruction</th><td class=\"pnotestd\">".$i['instruction']."</td></tr>";
                                echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
                                echo "<tr><td class=\"pnotes\" colspan=\"2\">Entered By: ".$i['user']."</td></tr>";
                                echo "<tr><th class=\"pnotes\" colspan=\"2\"><b><a href=upload/upload.php?eventid=".$i['print_note_num']."><i>EDIT THIS NOTE</i></a></th></tr>";
                                echo "</table>";
                                echo "<br />";
        }
}

[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.