How to show image from MYSQL data using PHP?

Sultan

New member
I have user data in MYSQL database and I want to show user's image from "images" table. I have this script but it says "user not found" while I have user's data in images table.

<?php
$error = "Unable to Connect.";
$connect = mysql_connect("localhost","root","") or die ($error);
mysql_select_db("phplogin") or die ($error);

$email = isset($_SESSION['email']);

$query = mysql_query("SELECT * FROM images WHERE email = '$email' ");
if(mysql_num_rows($query)==0)
die ("User not found!");
else
{
$row = mysql_fetch_assoc($query);
$location = $row['imagelocation'];

echo "<img src='$location' width='98' height='135' border='2px'>";
}
echo "<br />";

?>

Please tell me how to fix it?
Thanks in advance.
 
Back
Top