i have three entries in phpmyadmin id name and image
i want to upload image from the form into database and display that back into the form where from i am uploading it.I get this error
PHP Warning: mysql_insert_id() expects parameter 1 to be resource, null given in D:\path\to\sitename\httpdocs\sql\uploadimage.php on line 13 is first line
<?php
// connect to database
$id = mysql_insert_id(id);
$file = $_FILES['image']['tmp_name'];
if (!isset($file))
echo "Please Upload your Photograph.";
else
{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
if ($image_size==FALSE)
echo "Are you sure you uploaded an image";
else
{
if (!$insert = mysql_query("INSERT INTO fgusers4 VALUES ('','$image_name','$image')"))
echo "Problem Uploading Image.";
else
{
$lastid = mysql_insert_id();
echo "Image Uploaded.<p /> Your Photograph:<p /><img src=get.php?id=$lastid>";
}
}
}
?>
`$id = mysql_insert_id($id);
$file = $_FILES['image']['tmp_name'];`
`
`