i having problem doing a echo with <img> , the image do not seems to able to display although there is not error message. please advice... thanks for your help.

$pic = $row["img"];
  
  echo "$count.)&nbsp; $title, &nbsp;$price" ;
 echo '<img src="site_images/$pic" border=0>';

If you're not getting any errors but the image is broken, the URL is probably wrong. First make sure that $pic represents a file name that exists in the site_images directory, then make sure that that whole URL is accessible to the page as written.

If you're not getting any errors but the image is broken, the URL is probably wrong. First make sure that $pic represents a file name that exists in the site_images directory, then make sure that that whole URL is accessible to the page as written.

when i test on my browser, the broken image url link show as http://localhost/book/site_images/$pic

when i test on my browser, the broken image url link show as http://localhost/book/site_images/$pic

actually when i do a normal echo with $pic it able to show abc.jpg. but when under img tag it unable to show.

echo '<img src="site_images/$pic" border=0>';

will output

<img src="site_images/$pic" border=0>

variables between ' ' are not parsed but just printed
variables between " " are parsed

echo '<img src="site_images/'.$pic.'" border=0>';
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.