Why this Mysql query didn't work? Please help !
Ok I got many categories, and 1 category i have many products and i have reviews for those products. I got table "products_to_categories " with contains products_id and categories_id. I got another table " reviews " contain products_id and reviews_text, etc... So those 2 table relate by the products_id. Now i want to display those product reviews in that category but It didn't seem to work at all. Note: (int)$current_category_id is the current category, example: 15. I really need this one to work. Thanks alot for any help.
Below is the code i got:
$categories_to_products = "select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'";
$pcategories = tep_db_fetch_array($categories_to_products);
$reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 9000) as reviews_text, r.reviews_rating, r.comfort_rating, r.style_rating, r.date_added, r.customers_name, r.customers_id from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . $pcategories['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id desc";
$reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);