mysqli/PHP - first two rows never show up(table with row data going across columns then moving down) -
mysqli/PHP - first two rows never show up(table with row data going across columns then moving down) -
my website ignores first 2 images place database , proceeds add together images going across 5 columns , moving downwards next row.
update: shows 3 of 4 images in database. skips 1 image.
<?php $i = 1; echo "<table>"; while ($row = $recordset2->fetch_object()) { if ($i == 1) { echo "<tr>"; } echo '<td><img src="'.$row_recordset2['imgsource'].'" width="100" height="100"></td>'; if ($i == 5) { $i = 1; echo "</tr>"; } else { $i++; } } echo "</table>"; ?>
this database looks http://i.stack.imgur.com/ifba8.jpg
this website shows http://i.stack.imgur.com/wf7e1.jpg
try this:
<?php $i = 1; echo "<table>"; while ($row = $recordset2->fetch_object()) { if ($i == 1) { echo "<tr>"; } echo '<td><img src="'.$row['imgsource'].'" width="100" height="100"></td>'; if ($i == 5) { $i = 1; echo "</tr>"; } else { $i++; } } echo "</table>"; ?>
php mysqli
Comments
Post a Comment