<?php
header('Content-type: image/JPG');
$username = "root";
$password = "";
$host = "localhost";
$database = "image";

@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());

@mysql_select_db($database) or die("Can not select the database: ".mysql_error());




$query = mysql_query("SELECT * FROM img");
while($row = mysql_fetch_array($query)){
echo $row['image'];

}

?>

that code display first image just!!!!


plz help me!

is it repeat same image or loop stop after a time ?

it's just display the first image and stop.

i think the loop stop after display the first image

I think the problem is you set the header in this page as the image so it only displays 1. Try looping through the sql on another page and calling image.php with an idea of what image to show and doing it that way
eg. <img src="image.php?pid=4" /> then relating that '4' to a row in your table to get the correct image name. Then your script above only hits 1 particular image but the table itself is looped through on the parent page

thank u tommybs

its work now .....

//sir this is my code for retrive image from data base but image retrive in //broken form table name-image and field -name ,tempname, email plz solve where i am wrong

<?php
session_start();

error_reporting(E_ALL ^ E_NOTICE);

include('connect.php');


$email=$_SESSION['mail'];
$password=$_SESSION['pass'];

$sql="select * from image  where email='$email'";

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


$pic = mysql_fetch_array($result,MYSQL_BOTH);
echo "$pic";
$content = $pic['image'];
echo "$content";

echo "<img src='http:/localhost/rajanish@php/".$name['name']."' width='170' height='100'/>";

echo '<img src="resume//'.$name.'">';


?>

<html>
<head>
</head>
<body>
<img src="src=C:\wamp\www\rajanish@php\resume&w=100&h=80" alt="resized image" />
<img src="data:upload/jpeg;base64,<?php echo base64_encode( $name ); ?>" />
<img src="<?php echo $pic ?>" />
</body>
</html>

how to display multiple images in a row ????????

how to display multiple images in a row

Next time start a new discussion thread instead of replying to an old one.

Please explain clearly what you want, what you have and what isn't working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.