Re: loops? tips

From: Date: Thu, 17 Oct 2002 17:26:32 +0000
Subject: Re: loops? tips
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120368@lists.php.net to get a copy of this message
How about this: <? $query= "SELECT * FROM models_page WHERE id=$id"; $result= mysql_query($query); $a= mysql_fetch_assoc($result); for ($i = 0; $i <= 10; $i++) echo '<a href="' . = $a['photo' . $i] . '" target="_blank">Photo ' . $i . '</a>'; <? } ?> You can use GD or some external tool (like ImageMagick) to generate thumbnails off of each image. On Thu, 2002-10-17 at 13:27, Thomas Goeminne wrote: > > <? > $query= "SELECT * FROM models_page WHERE id=$id"; > $result= mysql_query($query); > $a= mysql_fetch_object($result); > ?> > > <a href="<? print"$a->photo1" ?>" > target="_blank">Photo 01</a> > <a href="<? print"$a->photo2" ?>" > target="_blank">Photo 02</a> > <a href="<? print"$a->photo3" ?>" > target="_blank">Photo 03</a> > <a href="<? print"$a->photo4" ?>" > target="_blank">Photo 04</a> > <a href="<? print"$a->photo5" ?>" > target="_blank">Photo 05</a> > <a href="<? print"$a->photo6" ?>" > target="_blank">Photo 06</a> > <a href="<? print"$a->photo7" ?>" > target="_blank">Photo 07</a> > <a href="<? print"$a->photo8" ?>" > target="_blank">Photo 08</a> > <a href="<? print"$a->photo9" ?>" > target="_blank">Photo 09</a> > <a href="<? print"$a->photo10" ?>" > target="_blank">Photo 10</a> > > let us supose that we want to print out this kind off html how can i make > this a shorter piece of code? > > the url to the picture is stored in a mysql dbase. > > Or is it possible to make thumbnailed pictures off them. > BTW i cannot change the server settings (i rent space) > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#120368) next »