Hello,
I'm having a problem with my code. It seem to only echo out the picture name from my database and not the picture.

This is my code

search.php

 $result = mysql_query("SELECT * FROM all WHERE (`title` LIKE '%".$query."%') OR (`add_type` LIKE '%".$query."%')") or die(mysql_error()); 
        if(mysql_num_rows($result) > 0)
  {
            while($results = mysql_fetch_array($result))
   { 
$photo = $results['image']; 

echo "  ".$results['image']."<a href='http://www.mysite.org/br/s.php?id=$id'><img src='/cate/upload/ $photo' width='100%' height='100%'></a>";
}
}

This is where i save my picture -> /cate/upload/

I think i have to leave the $result code, the only thing i need is to transform the $result['image']; to echo out the picture, not the name of the picture.

Recommended Answers

All 3 Replies

You have a space in the src URL, just before the $photo variable:

echo "  ".$results['image']."<a href='http://www.mysite.org/br/s.php?id=$id'><img src='/cate/upload/ $photo' width='100%' height='100%'></a>"

yea i see.. and i also had to take the ".$results['image']." off.

So, if solved, please mark as solved. Happy coding in 2014!

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.