global $mysql;
$offset='';
@$offset=$_GET['offset'];
if ($offset=='') {
$offset=0;
}
$gal_id = (int)$_REQUEST['gal_id'];
$query = "SELECT * FROM photos WHERE gal_id = '$gal_id' ORDER BY photo_id DESC";
//echo $query;
//exit;
$result = mysqli_query($mysql,$query);
$num_results = mysqli_num_rows($result);
$numrows=mysqli_num_rows($result);
$limit=16; // rows to return
$climit=" LIMIT $offset,$limit";
$limitquery = $query . $climit;
$result = mysqli_query($mysql,$limitquery);
$display = mysqli_num_rows($result);
// get the start and end numbers for the result list
if($offset==0){
$begin_result_num=1;
if($numrows > $limit){
$end_result_num=$limit;
}else{
$end_result_num=$numrows;
}
}else{
$begin_result_num=$offset+1;
if($numrows >($limit+$offset)){
$end_result_num=$limit+$offset;
}else{
$end_result_num=$numrows;
}
}
// now you can display the results returned
echo ' Number of Photos From '.get_gallery($gal_id).' Gallery Found: '.$begin_result_num.' - '.$end_result_num.' of '.$num_results.'';
?>