Help with array code

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?

$row_rsReviews = mysql_fetch_assoc($rsReviews);

that is grabbing the first result and doing nothing with it

while ($row = mysql_fetch_assoc($rsReviews)) {

that will now start at the second record

So how come it works OK in one case, but not in the other?

What do I need to change?

It can’t work ok in either case. You will never display the first row.

What is $row_rsReviews = mysql_fetch_assoc($rsReviews); for? did you put it there? why? If you want the while to display all rows, either remove it, or use mysql_data_seek(0) to put the pointer back at the beginning.

Ah! Sorry - I get you! It only looked like it was working in the first case.

I saw it as only showing the first record, rather than starting at the second record, as there are only currently two records in the second example.

Not sure what that line was doing there now that you mention it.

Thanks for taking the time to look at that - much appreciated.