array_chunk() - use or not use?
| From: | cLeAnEr | Date: | Fri, 20 Sep 2002 17:13:22 +0000 |
| Subject: | array_chunk() - use or not use? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-117045@lists.php.net to get a copy of this message | ||
Hi!
I got this problem getting my uploaded pictures listed in a table 3 by 3.
The script below works fine and make a nice listing vetically...
Now, how the heck do I script so that I get 3 pictures in a row, in separat
colums and adding a new row so next 3 pictures get the same formatting?
I looked into array_chunk() but I cant figure out how to use it? should i
split $pic_out and use a foreach on that array? or just $nr=count($pic_out);
and then run an if-statment to see if I get it out...well I hope u can give
me some help cuz this is driving me mad
reg: cleaner
<TABLE ALIGN="left" BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH="100">
<?
$sql="SELECT namn,sokvag,id FROM data ORDER by 'id' DESC";
$query=mysql_query($sql)or die(mysql_error());
while($pic_out=mysql_fetch_array($query)){
$name=$pic_out['name'];
$id=$pic_out['id'];
$path=$pic_out['sokvag'];
$img_source=$path.$name;
?>
<tr>
<?
echo "<TD> <IMG SRC='$img_source' height='100'
BORDER='0'><TD>";
}//end While
?>
</tr>
</table>