<?php
include("dbConfig.php");

if (isset($_POST['partId'])) {
    $partId = $_POST['partId'];

    // Fetch the unit price for the given partId
    $result = mysqli_query($db, "SELECT Price FROM particulars WHERE PartId = '$partId'");

    if ($result) {
        $row = mysqli_fetch_assoc($result);
        if ($row) {
            echo $row['Price']; // Return the price
        } else {
            echo 0; // Return 0 if no price found
        }
    } else {
        echo 0; // Return 0 if query failed
    }
}
?>
