I need help solving this issue. I have stored my pictures as blob in mysql database and when i try to run this code to retrieve data from the database, the pictures are displayed as punch of characters but the rest of data types are working fine. I think the browser does not know that the data is a picture. How can I convert the blob into pictures in this code.
<?php
include_once('db.php');
if(isset($_POST['personID'], $_POST['fName'], $_POST['lName'], $_POST['title'], $_POST['pic']))
{
$personID= $_POST['personID'];
$fName= $_POST['fName'];
$lName= $_POST['lName'];
$title= $_POST['title'];
$pic= $_POST['pic'];
if(mysql_query("INSERT INTO samidb.persons VALUES ('$personID','$fName', '$lName', '$title', '$pic')"))
echo "Successful Insertion!";
else
echo "Please try again";
}
$res = mysql_query("SELECT * FROM samidb.persons");
?>
<html>
<head>
<style type="text/css">
li { list-style-type: none; display: inline-block; padding: 10px; text-align: center;}
//li:hover { background-color: yellow; }
</style>
</head>
<body>
<form action="." method="POST">
person ID: <input type="text" name="personID"/><br />
First Name: <input type="text" name="fName"/><br />
Last Name: <input type="text" name="lName"/><br />
title: <input type="text" name="title"/><br />
pic: <input type="image" name="pic"/><br />
<input type="submit" value=" Enter "/>
</form>
<h1>List from database ..</h1>
<ul>
<?php
while( $row = mysql_fetch_array($res) )
echo "<li>$row[personID]. <li>$row[fName] <li>$row[pic]</li>
<li><a href='edit.php?edit=$row[personID]'>edit</a></li>
<li><a href='delete.php?del=$row[personID]'>delete</a></li><br />";
?>
</ul>
</body>
</html>