Not sure what’s going on here, but hopefully someone can spot where I’m going wrong.
Its especially weird, as I’m using the same code, with the same database table names etc but on a different site.
Basically, I’ve set up a database table to store customer feedback on products.
Its all working fine on this site :
http://www.mye-reader.co.uk/customerreviews.php
But on the site I’m working on, its only showing the first record. There are only a couple of records at the moment, but I’ve tried changing the query from ASC to DESC, and it swaps the one it shows, so it looks like the issue is with the array. Even though its the same code.
http://www.mybabymonitors.co.uk/reviews.php
Anyway, my query looks like :
mysql_select_db($database_connPixelar, $connPixelar);
$query_rsReviews = “SELECT * FROM feedback WHERE Approved = ‘Yes’ ORDER BY Product DESC”;
$rsReviews = mysql_query($query_rsReviews, $connPixelar) or die(mysql_error());
$row_rsReviews = mysql_fetch_assoc($rsReviews);
$totalRows_rsReviews = mysql_num_rows($rsReviews);
And the array code looks like :
<table cellpadding=“0” cellspacing=“0” width=“100%” border=“0”>
<?php
$groups = array();
while ($row = mysql_fetch_assoc($rsReviews)) {
$groups[$row[‘Product’]] = $row;
}
foreach ($groups as $product_name => $rows) {
echo “<tr><td class=\“product\”>$product_name</td></tr>”;
foreach ($rows as $row) {
echo “<tr><td class=\“review\”>”.$row[‘Review’].“</td></tr>”;
echo “<tr><td class=\“name\”>”.$row[‘CustomerName’].“</td></tr>”;
echo “<tr><td class=\“date\”>”.$row[‘Date’].“</td></tr>”;
}
}
?>
</table>
Any ideas what’s going on here?