<?php
include 'db.php';

$item_id = $_GET['item_id'];

$sql = "SELECT tr.rate FROM items i
	LEFT JOIN tax_rates tr ON i.tax_rate_id = tr.id
	WHERE i.id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $item_id);
$stmt->execute();
$stmt->bind_result($rate);
$stmt->fetch();

echo $rate ?: 0;
?>
