I run an SQL query, that when run in the db returns 6 records, all 6 records are to be echoed to the page as per this loop:
$i = 1;
while ($row = $result->fetch()) {
if ($i <= 3) {
$output[] = '<div id="featuredinner">';
$output[] = "\n";
$output[] = '<a href="images/'.$row['img'].'_lrg.jpg" rel="lightbox" title="'.$row['desc'].'"><img src="images/'.$row['img'].'_lrg.jpg" width=150px /></a><br />'."\n".' '.$row['title'].' - <strong>£'.$row['price'].'</strong><br /> <a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a>';
$output[] = "</div>\n ";
} else {
$output[] = '<br /><br /><br />';
$i = 0;
}
$i++;
}
I use the same loops on multiple other pages echoing records from the same table (just with different credentials) and they seem to be workign fine. It's jsut this one.. The bug is that the 4th record is never returned, 1, 2 and 3 are echoed on one line as desired, then its ment to drop a line and echo 4, 5 and 6, it doesnt, all i get is 5 and 6 and then a blank space.
Ideas?? As said the exact same piece of code for the loop and if statement is used on other pages (different product categroies) perfectly, the only difference is that the other sections have more items in, (some have 18-19 things in that are echoed on page 3 per line perfectly fine..
Page is live at http://www.thechocol...k/truf_milk.php if you want to see, ignore the DQL query being echoed to apge, I wanted to see what query the page was generating.
Thanks all, Dave.












