I have 3 images in an array. I want to display the first image in the array first, and then all 3 images in the array. I can get all the images to display in the array, but when I ask to show just the first image and then repeat the full array, only #2 and #3 are shown. How can I correct this?
Perhaps a better way of explaining this is, if I do this:
$row_main_image = mysql_fetch_array($result_images);
echo $row_main_image['path'];
...it does give me the first image, but when I do this after it:
while ($row_image = mysql_fetch_array($result_images)) {
echo '<td><center><img src="'.$row_image['path'].'" width="100"></center></td>';
$cellcount++;
if($cellcount >= $display_columns) {
$cellcount=0;
echo '</tr><tr>';
}
}
...it only gives me 2 of the 3 available images. I really want all 3 images again.
Query:
$query_images = "select *
FROM images
WHERE name LIKE '508429%'";
$result_images = mysql_query($query_images);
1 - show me first image in array
<td align="center" valign="top"><center><img src="<?php echo $row_image['path']; ?>" width="300" /></center>
<br />
<br />
2 - show me all images in array
$count = mysql_num_rows($result_images);
for($i=0; $i<$count; $i++)
{
if($i%$display_columns == 0)
echo '<tr>';
$cellcount=0;
while ($row_image = mysql_fetch_array($result_images)) {
echo '<td><center><img src="'.$row_image['path'].'" width="100"></center></td>';
$cellcount++;
if($cellcount >= $display_columns) {
$cellcount=0;
echo '</tr><tr>';
}
}
if(($cellcount>0) && ($count>$display_columns)){
for($fill=$cellcount;
$fill<$display_columns; $fill++){
echo '<td></td>';
}
}
if($i%$display_columns == $display_columns-1) {
echo '</tr>';
}
}