Jump to content

retriving all images from mysql db


mrjameer

Recommended Posts

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;

?>

thanks
mrjameer
Link to comment
https://forums.phpfreaks.com/topic/32731-retriving-all-images-from-mysql-db/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.