title: Attempting Image upload with PHP and mysqli, receiving an error
body: <p>I am trying to upload images into my database table called tbl_images and to my images folder saved in the same folder as my source files! i am receiving the error "Parse error: syntax error, unexpected '$imagename' (T_VARIABLE) in"</p>
  
  <p>Here is my index.php code</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Index&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="saveimage.php" method="post" enctype="multipart/form-data"&gt;
  &lt;h2&gt;Please click on Upload button&lt;/h2&gt;
  &lt;input type="file" name="uploadedimage"&gt;
  &lt;input type="submit" name="Upload Image" value="Upload Image"&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>Here is saveimage.php file. Not sure what the problem is here. Any help is appreciated. </p>
  
  <pre><code>&lt;?php
  
  include ("connection.php");
  function GetImageExtension($imagetype)
  {
      if(empty($imagetype)) return false;
      switch($imagetype)
      {
          case 'image/bmp':return '.bmp';
          case 'image/gif':return '.gif';
          case 'image/png':return '.png';
          case 'image/jpeg':return '.jpeg';
          default: return false;
      }
  }
  if(!empty($_FILES["uploadedimage"]["name"]))
  {
      $file_name=$_FILES["uploadedimage"]["name"];
      $temp_name=$_FILES["uploadedimage"]["tmp_name"];
      $imgtype=$_FILES["uploadedimage"]["type"];
      $ext=GetImageExtension($imgtype)
      $imagename=date("d-m-Y")."-".time().$.$ext;
      $target_path="images/".$imagename;
  
      if(move_uploaded_file($temp_name, $target_path))
      {
          $query_upload="INSERT into tbl_images 
          (image_name,submission_date) 
          values 
          ('".$imagename."','".date("Y-m-d")."')";
          mysqli_query($con,$query_upload);
              echo "Image has been uploaded";
          }
      }
      else {
          echo "Can not upload image";
      }
  ?&gt;
  </code></pre>