954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how can i output more than one image??

hi,

I have written this small code section

[PHP]<?php

// database connection
$host = "localhost";
$user = " ";
$pass = " ";
$db = " ";
$table= "test";

$conn = mysql_connect($host, $user, $pass)
OR DIE (mysql_error());
@mysql_select_db ($db, $conn) OR DIE (mysql_error());

$sql="SELECT * FROM $table WHERE image_id=100100";

$result=mysql_query($sql) or die(mysql_error( ));

$row=mysql_fetch_assoc($result);

$numfield=mysql_num_fields($result);


asort($row);

foreach ($row as $key => $val) {
if( $key != 'image_id' ){
$a=$key;
$b='.jpg';
$c=$a.$b;
$im=@imagecreatefromjpeg($c);
imageJPEG($im);
}
}


?>[/PHP]

but the output i got can only display one image, how can i display more than one image

thanks in advance,
tris

tristan17
Junior Poster in Training
51 posts since Sep 2005
Reputation Points: 10
Solved Threads: 1
 

You will need to call it as the image source each time it's required

eg

<img src='myimage.php?image_id=10001'>
<img src='myimage.php?image_id=12032'>
sarahk
Junior Poster
144 posts since Apr 2005
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You