Forum Moderators: coopster
$colname_DealRatingAvg = "-1";
if (isset($_GET['ProductID'])) {
$colname_DealRatingAvg = $_GET['ProductID'];
}
mysql_select_db($database_coupons_database, $coupons_database);
$query_DealRatingAvg = sprintf("SELECT avg(CommentRate) FROM cd_comments WHERE CommentCouponID = %s", GetSQLValueString($colname_DealRatingAvg, "int"));
$DealRatingAvg = mysql_query($query_DealRatingAvg, $coupons_database) or die(mysql_error());
$row_DealRatingAvg = mysql_fetch_assoc($DealRatingAvg);
$totalRows_DealRatingAvg = mysql_num_rows($DealRatingAvg);
<?php echo $DealRatingAvg ?>
SELECT avg(CommentRate) AS DealRatingAvg ...
... // then when retrieving the fetched assoc row you need to use the index
$row_DealRatingAvg = mysql_fetch_assoc($DealRatingAvg);
echo $row_DealRatingAvg['DealRatingAvg'];