Hi guys it's me again !!
I know this topic has been done to death but I unfortunately I am still stuck.
As advised by many, I have stored my images in a folder and save the image names in database (im using XAMPP).
In my database (called a_database) , I have columns called id, Type, Price1, Location, Price and photo. Under the photo column i saved my property photos names which are called image1, image2 and so on.
For your further information, I saved my property photos in the following folder xampp > htdocs > cimb22image .
When I run the html file, unfortunately nothing appeared. Please help a noob here !
akmal.html
<body>
Picture here:<br>
<img src=picscript.php?imname=image1><br>
<!--<img src=\"picscript.php?file={$row["id"]}\">";?><br>-->
</body>
</html>
picscript.php
<?php
$con = mysql_connect('localhost', 'root', '');
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("a_database", $con);
/*$image = stripslashes($_REQUEST[image1]);*/
$id = stripslashes($_REQUEST[id]); // removes backslashes or clean up data retrieved from db
$id = $_GET['id'];
$result = mysql_query("SELECT photo from a_database WHERE id=$id");
addslashes($image).".jpg\"";
$row = mysql_fetch_assoc($result);
/*$imagebytes = $row[imgdata];*/
$imagebytes = $row[id];
header("Content-type: image/jpeg");
echo $imagebytes;
?>
Any help greatly appreciated.