Hi all
How can I count the number of records relating to a certain ID, then show the records.
// selects venue list
$sql3 = "SELECT venue_id FROM tbl_venues";
$result3 = mysql_query($sql3) or die(mysql_error());
$DATA1=array();
while ($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) {
$row3['title']=str_replace("-"," ",(ucwords($row3['venue_id'])));
$row3['url']=str_replace(" ","-",(strtolower(ucwords($row3['venue_id']))));
$DATA1[]=$row3;
}
$num_rows2=mysql_num_rows($result3);
I also have a foreach loop which outputs:
venue 1
venue 2
venue 3
…
I have another table called tbl_reviews, which I query on the same page I want to query this table along with the above and show how many reviews there are for that venue_id.
// selects reviews from venue
$sql1 = "SELECT comments,
DATE_FORMAT(review_date, '%M %D %Y') AS subdir,
publisher, rating FROM tbl_reviews WHERE venue_id='" . str_replace("-"," ",mysql_real_escape_string(strtolower($_GET['venue_id']))) . "' AND confirmed=0 ORDER BY review_date DESC";
Do I just need to create a temporary key and echo this along side the above some how?
venue 1 (24)
venue 2 (62)
…
What is the simplest way?