Forum Moderators: coopster
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_LatestDeals = 15;
$pageNum_LatestDeals = 0;
if (isset($_GET['pageNum_LatestDeals'])) {
$pageNum_LatestDeals = $_GET['pageNum_LatestDeals'];
}
$startRow_LatestDeals = $pageNum_LatestDeals * $maxRows_LatestDeals;
$colname_LatestDeals = "-1";
if (isset($_GET['ProductBrand'])) {
$colname_LatestDeals = $_GET['ProductBrand'];
}
mysql_select_db($database_coupons_database, $coupons_database);
$query_LatestDeals = sprintf("SELECT * FROM products WHERE ProductBrand = %s ORDER BY ProductDateAdded DESC", GetSQLValueString($colname_LatestDeals, "text"));
$query_limit_LatestDeals = sprintf("%s LIMIT %d, %d", $query_LatestDeals, $startRow_LatestDeals, $maxRows_LatestDeals);
$LatestDeals = mysql_query($query_limit_LatestDeals, $coupons_database) or die(mysql_error());
$row_LatestDeals = mysql_fetch_assoc($LatestDeals);
if (isset($_GET['totalRows_LatestDeals'])) {
$totalRows_LatestDeals = $_GET['totalRows_LatestDeals'];
} else {
$all_LatestDeals = mysql_query($query_LatestDeals);
$totalRows_LatestDeals = mysql_num_rows($all_LatestDeals);
}
$totalPages_LatestDeals = ceil($totalRows_LatestDeals/$maxRows_LatestDeals)-1;
$colname_BrandPass = "-1";
if (isset($_GET['BrandName'])) {
$colname_BrandPass = $_GET['BrandName'];
}
mysql_select_db($database_coupons_database, $coupons_database);
$query_BrandPass = sprintf("SELECT * FROM brands WHERE BrandName = %s", GetSQLValueString($colname_BrandPass, "text"));
$BrandPass = mysql_query($query_BrandPass, $coupons_database) or die(mysql_error());
$row_BrandPass = mysql_fetch_assoc($BrandPass);
$totalRows_BrandPass = mysql_num_rows($BrandPass);
?>
<div id="Sorter">
SORT BY: <a href=""><img src="../images/brands/Sorter.png" border="0" />Expiration Date</a> <span>|</span>
<a href="">Price</a>
<span></span><span></span><span></span>
SHOW ONLY:
<span id="SelectedSort"><img src="../images/brands/Sorter.png" border="0" />All</span> <span>|</span>
<a href="deals.php?ProductShipping=1">Free Shipping</a>
</div>
<?php do { ?>
<div class="BrandDealsResults">
<?php
if($row_LatestDeals['ProductThumb']=="") {
echo '<div id="BrandDealsImgContainer"></div>';
}
else
{
echo '<div id="BrandDealsImgContainer"><a href="../products/coupons/details.php?ProductID='. $row_LatestDeals['ProductID'] .'"><img src="'. $row_LatestDeals['ProductThumb'] .'" alt="Low Cost Products" align="left" border="0"/></a></div>';}?>
<div id="BrandDealsContentRepeat"><a href="" class="BrandDealsTitle"><?php echo $row_LatestDeals['ProductName']; ?></a><br /><?php echo $row_LatestDeals['ProductCartDesc']; ?>
<span id="AdditionalDealInfo">
<?php
if ($row_LatestDeals['ProductLimited']=="1") {
echo '<span id="greentext">'. $limitedtimeoofer .'</span>';}
else {
echo '<span id="additonalinfo">'. $dateexpire .' '. date("F d, Y", strtotime($row_LatestDeals['ProductExpirationDate'])) .' </span>';}
?>
<?php if($row_LatestDeals['ProductSavingsCode']!="") { echo '
<br>
<span id="redtext">
'. $couponcode .' '. $row_LatestDeals['ProductSavingsCode'] . '
</span>';}?>
</span>
</div>
<div id="BrandDealsRatingsContainer"><?php echo $totalRows_DealsRatings ?> </div>
<div id="BrandDealsButton">
<span id="BrandDealsSave">SAVE: <?php echo $row_LatestDeals['ProductPrice']; ?></span><br />
<?php if ($row_LatestDeals['ProductPay']!=""){ echo '<span id="BrandDealsPay">PAY: $'. $row_LatestDeals['ProductPay'] .'</span><br />';} else { echo '';}
?>
<?php
if ($row_LatestDeals['ProductShipping']=="1"){
echo '<span id="BrandDealsShipping">+ Free Shipping</span>';}
else {
echo '';}
?>
<img src="../images/body/redirect-button.png" />
</div>
</div>
<?php } while ($row_LatestDeals = mysql_fetch_assoc($LatestDeals)); ?>