php - split images from array -
i getting links database , want display images break line every 5 images. can display images need help, i'm sure if statement don't know how write it. need display
image1,image2,image3,image4,image5 break image6,image7,image8,image9,image10 break
and on, have total of 100 images
<?php include('connect.php'); $query = "select * `image`"; $result = mysql_query($query); $pics = array(); while($row = mysql_fetch_array($result)){ $pics[] = "\"".$row['src']."\""; } foreach($pics $show){ echo "<img src=".$show.">"; } ?>
$count = 1; foreach($pics $show){ if($count < 6) { echo '<img src="'.$show.'">'; $count++; } else { echo '<br><img src="'.$show.'">'; $count = 1; } }
Comments
Post a Comment