I have the following code running in my site. It is done to show items 2 by 2, with a line break every time an even number is gotten.
This is all within a DIV:
while($info = $items->fetch(PDO::FETCH_ASSOC))
{
echo "<div name='item' id='".$info['color_base1']."' class='itemBox'>
<div class='showItem'><a href='items_descr.php?itemId=".$info[id_item]."'>
<img class='itemImage' alt='' src='images/$info[imageMid].jpg'></img></div></div><br />";
echo "<div class='indexItemText'><font class='similarItemsText'>
<a href='items_descr.php?itemId=".$info[id_item]."'>".$info[name]."</a>
<font class='price'> - $".$info[price]."</div>";
$row_count++;
if ($row_count % 2 == 0)
{
echo "<br />"; // close the row if we're on an even record
}
}
The problem is that my resulting CSS is doing something weird. It creates divs for the 1st 2 items and then it creates tags for the following items, to the point that these come out of the container div where they should be loaded…
Any idea of why this could be happening?
Please try this :-