Could you answer?

I've a table in mysql database the structure is like:
table name: img_tbl (id, image, size, format, etc..)
image defined as blob datatype inside the table.

i can retrieve single image from mysql database by using the following code.

$sql = "SELECT image,size,format FROM img_tbl";
 
        // the result of the query
        $result = mysql_query($sql) or die("Invalid query: " . mysql_error());
 
        // Header for the image
        header("Content-type: image/jpeg");
        echo mysql_result($result, 0,'imageData');

But i need to display multiple images with other attributes of table from table using php.

write two php files, one for showing all other data

file 1.php
1)fetch data from mysql with primary key
2) show all columns
3) <img src='file2.php?imgid=currid'>

file2.php //it will contain code you have written to show image in your post above, but it will use one get parameter to load specific single image.

$sql = "SELECT image,size,format FROM img_tbl where record_id='{$_GET['imgid']}'";
 
        // the result of the query
        $result = mysql_query($sql) or die("Invalid query: " . mysql_error());
 
        // Header for the image
        header("Content-type: image/jpeg");
        echo mysql_result($result, 0,'imageData');
commented: Thank You. this code was really helpful for me and for other who has same problem. +1

dear untrived,
thank you very much for given such a usefull logic.

filename:display.php

<?php

    $con=@mysql_connect('localhost','root','')or die(mysql_error());

    $sdb=@mysql_select_db('interview', $con)or die(mysql_error());

    $sql = "SELECT image FROM prodlist where id='{$_GET["id"]}'";

  // the result of the query
    $result = mysql_query($sql) or die("Invalid query: " . mysql_error());

  // Header for the image
    header("Content-type: image/jpeg");
    echo mysql_result($result, 0,'image');

?>

when i need to display a image, it works perfectly. when i updated image, change image to mysql table successfully, but image not displayed. It shows "The image cannot be displayed, it contains errors". Help me.
mysql table successfully,

hey there i have a page where i want to display a carousel with multiple images
based on category selection plz help me