Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//figure out what the user wants
//$Display_len is the number of records to display on one page
//get the values of the paging system
//If neither has a value then
if ((!$_POST['submit']=="Next")&&(!$_POST['submit']=="Previous")){
$NextBlock = 0;
//move forwards thru recordset results
}elseif($_POST['submit']=="Next"){
$NextBlock=+$Display_len;
//move backwards thru recordset results
}elseif($_POST['submit']=="Previous"){
$NextBlock=-$Display_len;
}
//can't move back past first record
if ($NextBlock < 0 ){
$NextBlock = 0;
}
$sql="select a.ad_id as aid, a.ad_title as title, a.ad_text as text,
u.user_id as uid, u.user_name as user, u.user_email as email
from ads a, users u
where ad_deleted = 0 and ad_duration >= now()
and a.ad_user_id = u.user_id order by ad_last_access_timestamp desc
limit $NextBlock, $Display_len";
//paging
echo "<td align=\"center\"><b> $total Ads available (Page $currpage of $totalpage)</b><br /><br />
<input type=\"hidden\" name=\"total\" value=\"$total\">
<input type=\"hidden\" name=\"NextBlock\" value=\"$NextBlock\">";
if ($total < $Display_len + $NextBlock + 1){ $NextStatus = " disabled ";}
if ($NextBlock == 0){ $PrevStatus = " disabled ";}
echo "<input type=\"submit\" value=\"Previous\" name=\"submit\" $PrevStatus > ";
echo "<input type=\"submit\" value=\"Next\" name=\"submit\" $NextStatus>";
echo "</td></tr>";