i have this search script that outputs all the data on the database. i would like to limit the number of data shown each page, let's say to 10 and put a next and back botton down.... anyone willing to help?
if ($EVENTYEAR == "") {$EVENTYEAR = '%';} if ($EVENTDATE == "") {$EVENTDATE = '%';} $result = mysql_query ("SELECT * FROM thisday WHERE EVENTYEAR LIKE '%$EVENTYEAR%' AND EVENTDATE LIKE '%$EVENTDATE%' ORDER BY EVENTYEAR ASC ",$conn); $resultall = mysql_query ("SELECT * FROM thisday"); $totalrecs = mysql_num_rows($resultall); $totalrows = mysql_num_rows($result); if ($row = mysql_fetch_array($result)) { do { echo "<table bgcolor=#FFFEEF border=0 cellpadding=2 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 width=100%> <tr><td align=left width=20% valign=top><b><font face=Verdana size=2 color=#800080><li>{$row['EVENTDATE']}</font></b></td> <td align=justify width=80% valign=top><font face=Verdana size=2 color=#000000>{$row['EVENTTEXT']}</td></table>"; echo ("<p>"); echo ("<p>"); } while($row = mysql_fetch_array($result)); } else {print "<font face=Verdana size=2 color=#FF0000><b>Sorry, no records were found!</font></b>";} ?> </td> </tr> </table> </td> </tr> </table> <? echo "<table bgcolor=#FFFEEF border=0 cellpadding=1 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 width=100%> <td align=left width=70% valign=top><font face=Verdana size=2 color=#FF0000><b>$totalrows</b></font><font face=Verdana size=2 color=#800000> out of </font><b><font face=Verdana size=2 color=#FF0000>$totalrecs</font></b><font face=Verdana size=2 color=#800000> record(s) found !</font></b></td></table>"; ?>
if ($EVENTYEAR == "") {$EVENTYEAR = '%';}
if ($EVENTDATE == "") {$EVENTDATE = '%';}
$result = mysql_query ("SELECT * FROM thisday WHERE EVENTYEAR LIKE '%$EVENTYEAR%' AND EVENTDATE LIKE '%$EVENTDATE%' ORDER BY EVENTYEAR ASC ",$conn);
$resultall = mysql_query ("SELECT * FROM thisday");
$totalrecs = mysql_num_rows($resultall); $totalrows = mysql_num_rows($result);
if ($row = mysql_fetch_array($result)) {
do {
echo "<table bgcolor=#FFFEEF border=0 cellpadding=2 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 width=100%> <tr><td align=left width=20% valign=top><b><font face=Verdana size=2 color=#800080><li>{$row['EVENTDATE']}</font></b></td> <td align=justify width=80% valign=top><font face=Verdana size=2 color=#000000>{$row['EVENTTEXT']}</td></table>";
echo ("<p>"); echo ("<p>"); } while($row = mysql_fetch_array($result)); } else {print "<font face=Verdana size=2 color=#FF0000><b>Sorry, no records were found!</font></b>";}
?>
</td> </tr> </table> </td>
</tr>
</table> <? echo "<table bgcolor=#FFFEEF border=0 cellpadding=1 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 width=100%> <td align=left width=70% valign=top><font face=Verdana size=2 color=#FF0000><b>$totalrows</b></font><font face=Verdana size=2 color=#800000> out of </font><b><font face=Verdana size=2 color=#FF0000>$totalrecs</font></b><font face=Verdana size=2 color=#800000> record(s) found !</font></b></td></table>"; ?>
this issue has been discussed so many times in the forum, search for pagination
reg kevin
there is a post I just replied to right on the first page of this section of the board, next to your post...
its called like "next and back buttons arent working right"
if you look at the resolution, and his code, it may help you