need help in php

hi

im new in php i write this code above and i have some problem with return value here is:
//quike.php
[php]

<?php mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("data1") or die(mysql_error());

$file=@$_FILES[“p”][“tmp_name”];

if(!isset($file))
{
echo “pic image”;
}
else
{

$image=addslashes(file_get_contents($_FILES[‘p’][‘tmp_name’]));
$image_name=addslashes($_FILES[‘p’][‘name’]);
$image_size=filesize($_FILES[‘p’][‘tmp_name’]);

if($image_size==FALSE)
{
    echo "not image";
}
else
{
   if(!$insert=mysql_query("INSERT INTO blob VALUES('','$image_name','$image')"))
   {
        echo "problem upload";
   }
       
    else
     {   
        $lastid=mysql_insert_id();
        echo "image uploaded<p />your image:<p /><img src=get.php?id=$lastid>";
     } 
}

}

?>

//get.php

<?php mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("data1") or die(mysql_error()); $id=addslashes($_REQUEST['id']); $image=mysql_query("SELECT * FROM blob WHERE id=$id"); $image=mysql_fetch_assoc($image); $image=$image['image']; header("Content-type: image/jpeg"); echo $image; ?>[/php]

frist problem : when add image then return blank image
second : when click on enter button then return… file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\quick.php on line 23
third: $file=@$_FILES[“p”][“tmp_name”]; when remove (@) return Undefined index: p in C:\xampp\htdocs\quick.php on line 11

thank’s for your Patience…waiting reply

Stop putting @ in front of variables for it suppress errors, you want to know what the errors are.

Sponsor our Newsletter | Privacy Policy | Terms of Service