Forums / Contribution-Writing Guidelines / Counting the total number of reviews for a given product.

Counting the total number of reviews for a given product.

Started by retched on 9 Feb 2012, 11:23 PM · Views: 1,557

Results 1 to 2 of 2
9 Feb 2012, 11:23 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Counting the total number of reviews for a given product.

I trying to pull the total number of reviews for a template and for some reason I keep getting one no matter what even though there's at least 2.

Can anyone help?

$reviews_query_raw = "SELECT r.reviews_id, rd.reviews_text as reviews_text, r.reviews_rating, r.date_added, r.customers_name
                        FROM " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd
                        WHERE r.products_id = :productsID
                        AND r.reviews_id = rd.reviews_id
                        AND rd.languages_id = :languagesID " . $review_status . "
                        ORDER BY r.reviews_id desc";

  $reviews_query_raw = $db->bindVars($reviews_query_raw, ':productsID', $_GET['products_id'], 'integer');
  $reviews_query_raw = $db->bindVars($reviews_query_raw, ':languagesID', $_SESSION['languages_id'], 'integer');
  $reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);
  $reviews = $db->Execute($reviews_split->sql_query);
15 Feb 2012, 12:43 AM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,129
Plugin Contributions:
56

Re: Counting the total number of reviews for a given product.

What does the variable $reviews_status contain?