<?php
    $db = mysqli_connect("localhost", "root", "", "dms_db");
   if ($db->connect_error) {
       die("Connection failed: " . $db->connect_error);
   }

  //   $msg = "";

  // // If upload button is clicked ...
  // if (isset($_POST['upload'])) {
  //   // Get image name
  //   $image = $_FILES['image']['name'];
  //   // Get text
  //   $image_text = mysqli_real_escape_string($db, $_POST['image_text']);

  //   // image file directory
  //   $target = "uploads/".basename($image);

  //   $sql = "INSERT INTO image_upload (image, image_text) VALUES ('$image', '$image_text')";
  //   // execute query
  //   mysqli_query($db, $sql);

  //   if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
  //       $msg = "Image uploaded successfully";
  //   }else{
  //       $msg = "Failed to upload image";
  //   }
  // }
  // $sql2="SELECT * FROM image_upload ORDER BY id DESC LIMIT 1 ";
  // // $sql3=" SELECT *FROM (SELECT *FROM image_upload ORDER BY id DESC LIMIT 2) tbl1 ORDER BY Id LIMIT 1";
  // $result = mysqli_query($db, $sql2);
  //  // $result2=mysqli_query($db, $sql3);
?>
