<?php
require_once 'databaseConnection.php'; // adjust path if needed

$mysqli = db_connect();

$result = $mysqli->query("SELECT invoiceNumber FROM invoiceRegistry ORDER BY id DESC LIMIT 1");

if ($result && $row = $result->fetch_assoc()) {
    echo htmlspecialchars($row['invoiceNumber']);
} else {
    echo ""; // or a default like "0000"
}
?>
