Jump to content

Archived

This topic is now archived and is closed to further replies.

mATOK

how to display 15 results, then a new page?

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]

Share this post


Link to post
Share on other sites
read up on the pagnation tutorial mate... easy to use as i new nothing and got it straight away

Share this post


Link to post
Share on other sites
I did not know one existed, thanx :)

Share this post


Link to post
Share on other sites

×

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.