title: How to store images in mysql database using php
body: <p>How can i store and display the images in a MySQL database. Till now i have only written the code to get the images from the user and store them in a folder, the code that i wrote till now is:
  <strong>HTML FILE</strong></p>
  
  <pre><code>&lt;input type="file" name="imageUpload" id="imageUpload"&gt;
  </code></pre>
  
  <p><strong>PHP FILE</strong></p>
  
  <pre><code>    $target_dir = "uploads/";
  $target_file = $target_dir . basename($_FILES["imageUpload"]["name"]);
  $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  
  
  if (move_uploaded_file($_FILES["imageUpload"]["tmp_name"], $target_file)) {
      echo "The file ". basename( $_FILES["imageUpload"]["name"]). " has been uploaded.";
  } else {
      echo "Sorry, there was an error uploading your file.";}
  </code></pre>