<?php
require_once('includes/load.php');
header('Content-Type: application/json');

// Get the part number from the query string
$part_number = isset($_GET['part_number']) ? $db->escape($_GET['part_number']) : '';

// Fetch product name based on part number
$sql = "SELECT name FROM products WHERE part_number = '$part_number' LIMIT 1";
$result = find_by_sql($sql);

// Output the result as JSON
echo json_encode($result ? $result[0] : []);
?>
