Mysql
 sql >> Database >  >> RDS >> Mysql

Errore di analisi:errore di sintassi, T_ELSE imprevisto

Hai un punto e virgola ; nella tua dichiarazione condizionale qui:

if (!$insert=mysql_query("insert into testblob values('','$image','$img_name')"));

Rimuovilo e cambialo in:

if (!$insert=mysql_query("insert into testblob values('','$image','$img_name')"))

perché non lo usi meglio?

   $file= $_FILES['image']['tmp_name'];
   if (!isset($file)){
      echo "Please select an image";
     }
   else{
        $image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
        $img_name= addslashes($_FILES['image']['name']);
        $img_size = getimagesize($_FILES['image']['tmp_name']);

       if ($img_size==FALSE){
             echo "select valid image.";
              }
       else
         {

              if (!$insert=mysql_query("insert into testblob values('','$image','$img_name')")){
                   echo "Problem uploading!"; }
              else{

                $lastid = mysql_insert_id();
                    echo "Image uploaded.<p />Your image:<p /><img src=get.php?id=$lastid>";
                }

        }
 }