Page 1 of 1

next back navigation!

Posted: Thu Jun 12, 2003 8:30 am
by sirTemplar
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>";
?>

Posted: Thu Jun 12, 2003 8:35 am
by cactus
This article should be right up your street:

http://www.devshed.com/Server_Side/PHP/ ... page1.html

:)

Regards,