$display = $a18[results];
$pg = (isset($_REQUEST['pg']) && ctype_digit($_REQUEST['pg'])) ?
$_REQUEST['pg'] : 1;
$start = $display * $pg - $display;
$result = mysql_query("SELECT count(*) FROM jobs where employerid = '$a19[employerid]' and status = '0'");
$total = mysql_result($result, 0);
$query = mysql_query("SELECT * FROM jobs where employerid = '$a19[employerid]' and status = '0' order by jobid desc limit $start, $display");
while($as = mysql_fetch_array($query))
{
?>
}
?>
if($total == 0)
{
?>
| There are currently no job vacancies advertised by this employer. |
}
?>
function paginate($display, $pg, $total) {
/* make sure pagination doesn't interfere with other query
string variables */
if(isset($_SERVER['QUERY_STRING']) && trim(
$_SERVER['QUERY_STRING']) != '') {
if(stristr($_SERVER['QUERY_STRING'], 'pg='))
$query_str = '?'.preg_replace('/pg=\d+/', 'pg=',
$_SERVER['QUERY_STRING']);
else
$query_str = '?'.$_SERVER['QUERY_STRING'].'&pg=';
} else
$query_str = '?pg=';
/* find out how many pages we have */
$pages = ($total <= $display) ? 1 : ceil($total / $display);
/* create the links */
$first = 'First
';
$prev = '
Previous';
$next = '
Next';
$last = 'Last';
/* display opening navigation */
echo '';
echo ($pg > 1) ? "$first : $prev :" : '« : :';
/* limit the number of page links displayed */
$begin = $pg - 4;
while($begin < 1)
$begin++;
$end = $pg + 4;
while($end > $pages)
$end--;
for($i=$begin; $i<=$end; $i++)
echo ($i == $pg) ? ' ['.$i.'] ' : ' '.$i.' ';
/* display ending navigation */
echo ($pg < $pages) ? ": $next : $last" : ': : »';
echo ' ';
}
paginate($display, $pg, $total);
?>
|
|