Hi all,
I have had this trouble before, and cant work out what it is.
Basically I have the pageing working, the stock showing correctly and the search keyword directing the page, but when I go to page 2 of the pageing, the page refreshes but the stock stays on page 1 and the pageing does too.
foreach ($_REQUEST as $key => $value ) {
$$key=(stripslashes($value));
}
$selectKeyword=@$_GET['search'];
if ($selectKeyword=="") {
$find_Search = $find;
$find_Search = strtoupper($find_Search);
} else {
$searching = "yes";
$find_Search = $selectKeyword;
$find_Search = strtoupper($find_Search);
}
<div id="result_Right_Results">
<?
//This is only displayed if they have submitted the form
if ($searching == "yes")
{
echo "<p style='position:relative; margin:0px; padding:0px; top:5px; padding-bottom:15px; font-size:26px'>Your Search Keyword: '".$find_Search."'<p>";
//If they did not enter a search term we give them an error
if ($find_Search == "")
{
echo "<p>You forgot to enter a search term";
exit;
}
// We preform a bit of filtering
$find_Search = strip_tags($find_Search);
$find_Search = trim ($find_Search);
//echo $find;
//Now we search for our search term, in the field the user specified
$absolutepage=$post['absolutepage'];
$pagesize=$post['pagesize'];
include "PageNavigator.php";
var_dump ("SELECT * FROM tbl_hotels WHERE upper(Nom_Hot) LIKE '%$find_Search%' AND Act_Hot=1");
$sql.= "SELECT * FROM tbl_hotels WHERE upper(Nom_Hot) LIKE '%$find_Search%' AND Act_Hot=1";
$mQry=$sql;
$mPageSize = @$HTTP_POST_VARS["txtPageSize"];
if ((!isset($mPageSize))||intval($mPageSize)==0)
{
// $mPageSize = @$HTTP_GET_VARS["pagesize"];
$mPageSize = $pagesize;
if ((!isset($mPageSize))||intval($mPageSize)==0)
$mPageSize = 10;
}
$mUrl = $PHP_SELF."?pagesize=".$mPageSize.$mConQry_Str."&search=".$find_Search;
$mAbsolutePage = $absolutepage;
if (!isset($mAbsolutePage))
{ // Set $mOffset and absolutepage if not set
$mAbsolutePage = 1;
//echo "lee2";
//echo $mAbsolutePage;
$mOffset = 0;
} else {
$mOffset = ( $mAbsolutePage - 1 ) * $mPageSize;
//echo "lee3";
}
$mResult = mysql_query($mQry) or ("Wrong Select Query");
$mRecordCount = mysql_num_rows($mResult);
$mPageCount = intval($mRecordCount / $mPageSize);
if ($mRecordCount % $mPageSize ) $mPageCount++;
if ($mAbsolutePage>$mPageCount) $mAbsolutePage=$mPageCount;
$mOffset = ( $mAbsolutePage - 1 ) * $mPageSize;
if ($mRecordCount == 0)
{
}
if($mOffset<0)
{
$mOffset=0;
}
$mQry .= " LIMIT $mOffset, $mPageSize "; // Get record set = $mPageSize every time
$mRes = mysql_query($mQry);
if ($mAbsolutePage == 1)
{
$mPag1 = $mAbsolutePage;
//echo $mAbsolutePage;
}
else
{
$mPag1 = (($mAbsolutePage - 1) * $mPageSize) + 1;
}
$mPag2 = $mPag1 + ($mPageSize - 1);
if ($mPag2 > $mRecordCount)
$mPag2 = $mRecordCount;
$result=mysql_query($mQry) or die("Wrong Query");
$records=mysql_num_rows($result);
//End of paging
?>
<?php if(!$mRecordCount == 0) { ?>
<div style="position:relative; width:772px; float:left; height:auto; font-size:15px; padding-bottom:10px; padding-left:2px; z-index:10;">
<?=PagNav($mPageSize, $mPageCount, $mAbsolutePage, $mRecordCount, $mQry, $mUrl);?> - Records <?=$mPag1?> to <?=$mPag2?> (of <?=$mRecordCount?>)
</div>
<? } ?>
<?
//$color="1";
if($records>0)
{
$cnt=$records;
} ?>
<?
//while($q=mysql_fetch_array($retval)){
if(($i%0)==0 || $i==0 ){ ?>
<? for($j=1; $j<=$cnt; $j++) {
$morevalue=true;
$q=mysql_fetch_assoc($result) or $morevalue=false;
if($morevalue){
?>
<div class="result_Hotel">
<div class="result_Hotel_Pic"><a href="hotel.php?hotel_ID=<?=$q['Id_Hot']?>&Type=<?=$q['IdType_Hot']?>&Resort=<?=$q['IdRsrt_Hot']?>" title="<?=$q['Nom_Hot']?> - More Info"><img src="<?=$q['Foto1_Hot']?>" width="176" height="118" border="0" /></a></div>
<div class="result_Middle_Section">
<div class="result_Middle_Section_Top"><span style="position:relative; line-height:27px; height:27px; vertical-align:8px"><a href="hotel.php?hotel_ID=<?=$q['Id_Hot']?>&Type=<?=$q['IdType_Hot']?>&Resort=<?=$q['IdRsrt_Hot']?>" title="<?=$q['Nom_Hot']?> - More Info" class="result_Link"><?=$q['Nom_Hot']?></a></span>
<?php $int=$q['IdCat_Hot'];
if (in_array($q['IdCat_Hot'], array(6, 7))) { ?>
<? } else {
if($int>0) { $k=0; while($k<$int) { ?><img src="site_images/orange_Star_White.jpg" width="21" height="27" /><?php $k++; } } ?>
<? } ?>
</div>
<div class="result_Middle_Section_Middle_1"><?=$q['Dir_Hot']?></div>
<div class="result_Middle_Section_Middle_2">COMPLIANT WITH THESE STANDARDS</div>
<div class="result_Middle_Section_Bottom">
<?php
$x=mysql_query("SELECT distinct(tbl_standards.Id_Stand), tbl_standards.stand_Name, tbl_standards.Id_View, tbl_standards.Nom_Stand FROM tbl_standards LEFT JOIN tbl_hotnstand ON ( tbl_standards.Id_Stand = tbl_hotnstand.Id_Stand ) WHERE tbl_hotnstand.Id_Hot =".$q['Id_Hot']." AND (tbl_standards.Id_View=1)");
while($z=mysql_fetch_assoc($x)){ ?>
<? if ($z['Id_Stand'] == '18' ) { ?>
<? } else { ?>
<?
$imageTag = $z['Nom_Stand'];
$imageTag = str_replace('<?= $icon_Height ?>', $icon_Height, $imageTag);
$imageTag = str_replace('<?= $icon_Width ?>', $icon_Width, $imageTag);
?>
<a href="javascript:popUp('<? echo "standdata.php?srno=$z[Id_Stand]"; ?>','')" title="<?=$z['stand_Name']?>"><?=$imageTag?></a>
<? } ?>
<? } ?>
</div>
</div>
</div>
<div class="gap_Result"></div>
<div class="gap_Line_Result"></div>
<div class="gap_Result"></div>
<? }
}
}
// End Build query
?>