VIP Offerings
All the Coupons are displayed here.
Results: print $total_records; ?> Business(s) found print $res1 ?>
include("header.php"); ######### Admin Profile $cqry = "select * from ".ADMINPROFILE.""; $cres = mysql_query($cqry)or die(db_error()); $carr = mysql_fetch_array($cres); $adminid = $carr['intAdminId']; $com_logo = $carr['Logo']; $setqry = "select * from ".SETTINGS.""; $setres = mysql_query($setqry)or die(db_error()); $setarr = mysql_fetch_array($setres); $coupondisp = $setarr['HotTopics']; ######### Get Restaurant Address $dt=date("Y-m-d"); $page="coupon"; $objGetResult = mysql_query("select * from ".CMS." where varMenutype='coupon'"); $objGetRow = mysql_fetch_array($objGetResult); $CMSId = $objGetRow['intCMSId']; $heading = $objGetRow['varHeading']; $content = stripcslashes($objGetRow['varDetail']); $title=$objGetRow['varTitle']; ############# Get Restaurant Name $res="select * from tb_merchant where intId = '".$_GET['resid']."'"; $Disres=mysql_query($res) or die(mysql_error()); $Resarr=mysql_fetch_array($Disres); $ResName = $Resarr['varRestaurantName']; #############Search Qry if($_REQUEST['zipcode'] != "") $zipcode=$_REQUEST['zipcode']; $Zip=substr($zipcode,0,2); if($_REQUEST['statename'] != "") $state=$_REQUEST['statename']; if($_REQUEST['cityname'] != "") $city=$_REQUEST['cityname']; if($_REQUEST['resname']!="") $resname=$_REQUEST['resname']; if($_REQUEST['cusinetype']!="") $cusinetype=$_REQUEST['cusinetype']; if($zipcode != "") { $Val="Zipcode like '$Zip%'"; } else if($state != "" && $city == "") { $Val="varState = '$state'"; } else if($state != "" && $city != "") { $Val="varState = '$state' and varCity = '$city'"; } else if($resname != "" ) { $Val="varRestaurantName = '$resname'" ; } else { } //print $CUS_Id; //print $CUS_Id1=trim($CUS_Id,","); if($zipcode != "" || $state != "" || $city != "" || $resname != "" || $cusinetype != "") { if($Val != "" ) { $zip_Qry="select * from tb_merchant where ".$Val." "; $SipRes=mysql_query($zip_Qry); $num=mysql_num_rows($SipRes); $i=1; if( $num > 0) { while($ZipArr=mysql_fetch_array($SipRes)) { $RID=$ZipArr['intId']; if($num == $i) $sep=""; else $sep=","; $ZipId.=$RID.$sep; $i=$i+1; } } } if($ZipId != "") { $ZIP_ID = " and coupon.MerchantId in ($ZipId)"; $set_val="Set"; } else if($cusinetype != "" ) { $CUS_Id=""; $SELRES="select * from tb_restaruntinfo where intCusineId = '$cusinetype'"; $RES_REST=mysql_query($SELRES) or die(mysql_error()); while($ResARR=mysql_fetch_Array($RES_REST)) { $CUS_Id=$ResARR['MerchantId']; $CUS_Id.=","; } $CUS_Id1=trim($CUS_Id,","); if($CUS_Id1 != "") { $CUSINE=" and coupon.MerchantId in ($CUS_Id1)"; $set_val="Set"; } else $set_val = "Null"; } else $set_val = "Null"; } if($_GET['resid'] != "") { $pagqry="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' and coupon.MerchantId = '".$_GET['resid']."' and coupon.CouponStatus = 'Active' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc "; $pagres="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' and coupon.MerchantId = '".$_GET['resid']."' and coupon.CouponStatus = 'Active' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc limit $start1, $coupon_per_page "; } else { if($set_val == "Set") { $pagqry="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' ".$ZIP_ID.$CUSINE." and coupon.CouponStatus = 'Active' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc "; $pagres="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' ".$ZIP_ID.$CUSINE." and coupon.CouponStatus = 'Active' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc limit $start1, $coupon_per_page "; } else if($set_val == "Null") { $pagqry="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' and coupon.CouponStatus = 'InActive' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc "; $pagres="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' and coupon.CouponStatus = 'InActive' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc limit $start1, $coupon_per_page "; } else { $pagqry="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' and coupon.CouponStatus = 'Active' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc "; $pagres="select * from tb_coupon coupon,tb_order orders where coupon.dtStDate <= '$dt' and coupon.dtEndDate >= '$dt' and coupon.CouponStatus = 'Active' and coupon.intCouponId = orders.CouponId GROUP BY coupon.MerchantId order by orders.intOrderNo asc limit $start1, $coupon_per_page "; } } if($zipcode != "") { $res1=" in the Zipcode '".$zipcode."'"; } else if($resname != "") { $res1=" in the name '".$resname."'"; } else if($state != "") { foreach($statearray as $statekey => $statevalue){ if($statekey == $state) $st=$statevalue; } $res1.=" in the State '".$st."'"; ############### Find City if($city != "") { $cityquery1="select * from ".CITY." where intCityId ='".$city."' "; $cityresult1=mysql_query($cityquery1); $cityarr1=mysql_fetch_array($cityresult1); $cityname1=$cityarr1['varCityName']; $res1.=" and the city '".$cityname1."'"; } } else if($cusinetype != ""){ $cusineQuery1="select varCusine from ".CUSINE." where intCusineId = '".$cusinetype."' "; $cusineResult1=mysql_query($cusineQuery1); $cusineArray1 = mysql_fetch_array($cusineResult1); $cusine_type = $cusineArray1['varCusine']; $res1=" in the cuisine type '".$cusine_type."'"; //if($val != "") //$res.=" and Restaurant name begins with '".$val."'"; } //print $pagqry; $pag_res = mysql_query($pagqry); $total_records = mysql_num_rows($pag_res); $pages = ceil($total_records / $coupon_per_page); $CouponRes = mysql_query($pagres)or die("Error".mysql_error()); $CouponRow = mysql_num_rows($CouponRes); $total_records = mysql_num_rows($CouponRes); ?>
All the Coupons are displayed here.
Results: print $total_records; ?> Business(s) found print $res1 ?>