mrjameer Posted January 3, 2007 Share Posted January 3, 2007 hi,i want to retrieve all images which are present in mysql table.i want to display 5 images per row.but when i fetch image it shows one image only.here is my code.how to solve this problem.any of your help will be appreciated<?php $conn4=mysql_connect("localhost","","");mysql_select_db("jo",$conn4);$sql = "SELECT name, type, size, content FROM image_upload"; $result = mysql_query($sql,$conn4) or die(mysql_error()); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; ?> thanksmrjameer Link to comment https://forums.phpfreaks.com/topic/32731-retriving-all-images-from-mysql-db/ Share on other sites More sharing options...
marcus Posted January 3, 2007 Share Posted January 3, 2007 [code]while($row = mysql_fetch_assoc($result)){$name = $row[name];$type = $row[type];$size = $row[size];$content = $row[content];echo "$name<br>$type<br>$size<br>$content";}[/code] Link to comment https://forums.phpfreaks.com/topic/32731-retriving-all-images-from-mysql-db/#findComment-152386 Share on other sites More sharing options...
ShogunWarrior Posted January 3, 2007 Share Posted January 3, 2007 It can't possibly show more than one image per page, unless they are embedded as external images in a html page.So, for instance you could have this HTML:[code]<img src="dB_image.php?image=72" /><img src="dB_image.php?image=75" />[/code]dB_image.php gets the image Id from $_GET['image'], queries the DB and returns the image. This way you can have more than one image per page. Link to comment https://forums.phpfreaks.com/topic/32731-retriving-all-images-from-mysql-db/#findComment-152392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.