Hi,
I have 2 tables of data REVIEWS and RATINGS
I would like to show a list of my reviews and a list of rating for each of my reviews
I have tried putting my second WHILE loop inside teh first one but that doesn't work, can anyone please help?
here is my code:
$SQL = "SELECT
*
FROM
school_reviews
WHERE
active = 1
AND is_deleted = 0
AND school_id = '" . $school_id . "'
ORDER BY
review_date DESC";
$q->query($DB,$SQL);
while($review = $q->getrow()):
$reviewid = $review['review_id'];
echo $reviewid;
echo '<h3>'.$review['review'].'</h3>';
endwhile;
echo '<ul>';
$SQL = "SELECT
*
FROM
ratings
WHERE
review_id = '".$reviewid."'";
$q->query($DB,$SQL);
while($rating = $q->getrow()):
echo '<li>'.$rating['rating_name'].': '.$rating['rating'].'</li>';
endwhile;
echo '</ul>';
here is an example of the review I get:
ReviewID: 46
Review: testing the reviews
ReviewID: 43
Review: Because I know John is sooo handsome and he works at Cactus
ReviewID: 40
Review: iuhi
Ratings:
Course / Course content: 5
Teacher: 5
Social Programme: 5
School Facilities: 5
Atmosphere: 5
Location: 5
Accommodation: 4
Service from Cactus: 2
Value for money: 3
Overall Experience: 5