Hi, I am trying to display multiple images on a search page. If name comes up in search so does image under same user id. It works only for one image for all names same. Example: Facebook, same name found in search but different images. I'm thinking a do while loop on the get.php page where the

header("Content-type: image/jpg")

is but I'm not sure how to do this. Here is the get.php page:

<?php 
$image = "-1";
if (isset($_SESSION['image'])) {
  $image = $_SESSION['image'];
}
header("Content-type: image/jpg");
echo $image;
?>

Any advice would be awesome, Thanks

Recommended Answers

All 2 Replies

Not clear on your problem. Also don't understand why you have chosen to use a header. Why not use:

if (isset($_SESSION['image'])) {
  echo "<img src=".$_SESSION['image'].">";
}

Thanks for response. Anyway,
1) I am building a site that allows users to register.
2) Users can search for other registered users by searching first and last name.
3) When a list of users with the first and last name appear I want there picture along with it.
If 10 people with same name come up in search the picture 'thumbnail' will be different.
The problem I am having is I can not seem to get more than one image to display with multiple search results.
If I dont use a header function images will display as text.
Images are uploaded by users into mysql.
For search.php I use

echo "Your Image<p/><?php <img src=get-avatar.php?>

.
As for get-avatar.php I use code above.
Thanks again.

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.