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
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.