<?php
    session_start();

    require("../includes/database_connect.php");
    $id = $_POST['id'];
    $description = $_POST['description'];
    $quantity = $_POST['quantity'];
    $brand = $_POST['brand'];
    $location = $_POST['location'];
    
    $sql = "UPDATE tools SET description='$description', quantity='$quantity', brand='$brand', location='$location' where id='$id'";
  
    if ($conn->query($sql)) {
        $_SESSION['success'] = $description." updated successfully";
    } else {
        $_SESSION['error'] = "Error updating record: " . $conn->error;
    }
    
    header('location: ../tools_listing.php');
?>