Hi there,
I have written a code on retrieving image from the database. But I gt a error notice from my show_image.php file.
Here's the code:
<?php
//connect to database
$connection = mysql_connect("localhost", "root", "") or die('cant make connection : ' . mysql_error());
$database = mysql_select_db ("mentormenteesystem", $connection) or die ("Could not select database");
//save the name of image in table
$query = mysql_query("select * from tbl_img") or die(mysql_error());
//retrieve all image from database and store them in a variable
while($row = mysql_fetch_array($query))
{
$img_name = $row['img'];
$image = "<img src='site_images/$img_name' /><br />";
//store all images in one variable
$all_img = $all_img . $image;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php echo $all_img;?>
</body>
</html>
The error notice is in this line
$all_img = $all_img . $image;
How to correct it?