I am in the process of adding pageing to my output, but although the code seems fine to me, no results are coming out.
<?
if (!(isset($pagenum)))
{
$pagenum = 1;
}
// Build result query on values of the array
$sql.="select * FROM tbl_hotels $max". ((!empty($sqlcategory)) ? $sqlcategory : "") ." WHERE Act_Hot='1' ". ((!empty($sqlcategory2)) ? $sqlcategory2 : "") ." ";
if ($sqlregion==""){
$sql.= " AND IdCntry_Hot='".$selectCountry."'" ;
} else {
$sql.= "" .$sqlregion . "";
}
if ($sqlstar==""){
$sql.= " AND IdCat_Hot IN (1,2,3,4,5,6)";
} else {
$sql.= "" . $sqlstar . "";
}
$order = " GROUP by Id_Hot ASC";
$order2 = " GROUP by tbl_hotels.Id_Hot ASC";
$sql.= "". ((!empty($sqlcategory)) ? $order2 : $order) ."";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
//echo $sql;
//Start of pageing
$page_rows = 4;
$last = ceil($rows/$page_rows);
if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
//End of paging
while($q=mysql_fetch_array($rows)){
?>
<div class="result_Hotel">
<p style="position:relative; margin:10px;"><?=$q['Id_Hot']?></p>
<p style="position:relative; margin:10px;"><?=$q['Nom_Hot']?></p>
</div>
<? }
// End Build query
?>
</div>
</div>
The output returns, when I change
while($q=mysql_fetch_array($rows)){
back to
while($q=mysql_fetch_array($result)){