i use this code for display image in my web page but IE doesn’t show image
<?php
// connect to mysql server
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// connect to database server
$db_selected = mysql_select_db('admin', $link);
if (!$db_selected) {
die ('Database error : ' . mysql_error());
}
$sql = mysql_query("SELECT 'path' FROM image WHERE id='3' ");
while($row= mysql_fetch_array($sql)){
$image = $row['path'];
// $image = $row['path'];
echo'<img src="$image"/>';
}
?>
Here’s my guess as to what’s happening: You’re printing the <img> element like so:
echo'<img src="$image"/>';
You expect $image to be replaced with the actual path to the image, but your string is wrapped in single quotes. So I think your HTML source is just going to look like this (without the newlines, of course):
<img src="$image"/>
<img src="$image"/>
<img src="$image"/>
<img src="$image"/>
Try changing your string so that it’s inside double quotes instead:
echo "<img src=\\"$image\\"/>";
Eagle eyes! Very good catch.
So I guess the answer to my question is: no, the images didn’t show up in any browser.