title: Upload multiple images to Database MYSQLI
body: <p>I am planning to have a web gallery. However, it is hard for me to use PHP to insert DB. The following code:</p>
  
  <p>HTML -- I want to make a form which has category and multiple images that can be inserted into DB at the same time.</p>
  
  <pre><code>&lt;form action="upload" method="POST" enctype="multipart/form-data"&gt;
      &lt;p&gt; Upload : &lt;input type="file" id="file" name="images" /&gt; &lt;/p&gt;
      &lt;p&gt; Category : &lt;input type="text" name="imageCategory"&gt; &lt;/p&gt;
      &lt;p&gt; &lt;input type="submit" name="submit" value="Upload!" /&gt; &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>DATABASE </p>
  
  <p><code>I am using imageName as VARCHAR not BLOB TYPE.</code></p>
  
  <p>PHP </p>
  
  <pre><code>&lt;?php
  include ("dbConnect.php");
  
      if(isset($_POST["submit"])) {
  
          $image = $_POST['images']['tmp_name'];
          $imageName = $_POST['images']['name'];
          $imageSize = $_POST['images']['size'];
          $imageType = $_POST['images']['type'];
          $imageCategory = $_POST['imageCategory'];
  
          $result =   $mysqli-&gt;query("INSERT INTO imageTable (imageName, imageCategory, imageSize, imageType) 
                                    VALUES ('$imageName', '$imageCategory', '$imageSize' , '$imageType' );")
  
                      or die(mysqli_error($mysqli));
  
      } else {
  
          echo "&lt;p&gt; It is not working &lt;/p&gt;";
  
      }
  
      header("location: index"); 
  
      $mysqli-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>The problem is, the category is the only one has inserted into the database successfully. But not with the imageName, imageType, and imageSize. And also i want the image to be stored into database so that I can retrieve the image from DB on the other web page. Any ideas?</p>