Hi guys,
I have written a simple code here that should be able to display the image "tulips" from my database?
But it does not work, wondering what is wrong with the code?
<?php
// database connection
$host = "localhost";
$user = "user";
$pass = "password";
$db = "imagedb";
$table= "image";
$conn = mysql_connect($host, $user, $pass)
OR DIE (mysql_error());
@mysql_select_db ($db, $conn) OR DIE (mysql_error());
$sql="SELECT * FROM image WHERE image_name= 'tulips' " ;
$result=mysql_query($sql,$conn);
if (mysql_num_rows ($result)>0)
{
$row = @mysql_fetch_array ($result);
$img_type = $row["image_type"];
$img=$row["image"];
header ("Content-type: $img_type");
print $img;
}
?>
any help will be appreciated
tristan