0

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>';
3
Contributors
4
Replies
6
Views
5 Years
Discussion Span
Last Post by pzuurveen
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.

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.

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

0
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>';

Edited by pzuurveen: n/a

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.