<?php
session_start();
include('script/condb.php');

//$con = new mysqli("localhost","root","","your_database");
//if ($con->connect_error) die("Connect error: ".$con->connect_error);

$pid = intval($_POST['projectid']);
$new = $_POST['default_uom'] ?? 'm';
$allowed = ['inch','cm','m','yd','px'];
if (!in_array($new, $allowed)) die("Invalid unit.");

$stmt = $con->prepare("UPDATE upline_app_project_info SET default_uom=? WHERE project_ref=?");
$stmt->bind_param("si", $new, $pid);
$stmt->execute();
echo "✅ Project $pid default UOM set to $new.";
