0

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

Edited by phpDave: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by phpDave
0

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'].">";
}
0

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.

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.