OK, I've spent a few hours researching and trying things out, but I need some help from the brilliant minds of phpbuilder.com.
I have a page that shows a list of reviews. After clicking a review and going to it's page, visitors have the ability to post comments. I want to show how many comments have been posted per review on the main page (with the list of reviews). I've come close, but when the script is executed, instead of the total comments number, I only see the actual word "Array". I am still fairly new to php, and have not found a solution after hours of searching, so any help is appreciated. The code...
//start code
$db = mysql_connect("localhost", "$login", "$password");
mysql_select_db("oddshaped",$db);
$result = mysql_query("SELECT id, band, album FROM reviews order by band", $db);
if ($myrow = mysql_fetch_array($result)) {
do {
$result1 = mysql_query("select reviews.id, reviews.band, count(reviewcomments.review) from reviews, reviewcomments where reviews.id = reviewcomments.review group by reviews.id");
printf("<img src=\"images/news2.gif\" align=\"left\"><a href=\"http://www.oddshaped.com/index2.php?text=albumreview&reviews=%s\"><font color=\"#990000\"><b>%s</font> - \"%s\"</a><br><font color=\"#333333\">[comments: %s]</font><p>", $myrow["id"], $myrow["band"], $myrow["album"], $myrow=mysql_fetch_array($result1));
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
//end code
I am fairly confident my error is in the last part of the PRINTF line, where I attempted to fetch $result1. Big thanks in advance to anyone who can help!