0

it keep on printing 1st image from database. but i want to print all the differenct images.

$id = $_SESSION['user_id']; 

//select images from database
    $sql = "SELECT * FROM image WHERE user_id = $id ORDER BY image_id DESC";
    $result = mysql_query($sql);

while($row = mysql_fetch_assoc($result))
{
    <img src="image.php?id='.$row['image_id'].'" />
}






    image.php
    <?php
    session_start();
    include("connect.php");

    $user_id = $_SESSION['user_id']; 

    $image = mysql_query("SELECT * FROM image WHERE user_id = $user_id ");
    $image = mysql_fetch_assoc($image); //get access to image table
    $image = $image['image'];
    echo base64_decode($image); 
?>

Edited by hwoarang69

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by xungo2000
0

i was think on my image.php file where it say echo ;

echo base64_decode($image);

right after that i can some how go to next row?

Edited by hwoarang69

0

I think you have first save to file on server with a temporary name.

 while($row = mysql_fetch_assoc($result))
{    
    $filename = SaveToFile($row['image_id']);
    <img src="image.php?id='.$filename.'" />
 }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.