exec($createQuery);
if (!$db->exec($createQuery)) {
die("Failed to create the 'projects' table.");
}
$db->close();
} else {
$db = new SQLite3($dbFile4);
if (!$db) {
die("Database connection failed: " . $db->lastErrorMsg());
}
}
// Function to fetch and display data
function displayData($db) {
$query = "SELECT id, item, description, subtotal, invoicefull FROM figures";
$result = $db->query($query);
$invoiceNumber = $_SESSION['invoiceNumber'];
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$projectId = $row['id'];
if ($invoiceNumber == $row['invoicefull']){
$item = $row['item'];
$description = $row['description'];
$subtotal = $row['subtotal'];
$items = explode(", ", $item);
$descriptions = explode(", ", $description);
$subtotals = explode(",", $subtotal);
for ($i = 0; $i < count($items); $i++) {
echo "
";
echo "| " . $items[$i] . ' | ';
echo "" . $descriptions[$i] . ' | ';
echo "R" . $subtotals[$i] . " | ";
echo " | ";
echo '
';
}
}
}
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["update"])) {
$updatedData = $_POST["updatedData"];
$projectId = $_POST["projectId"];
}
?>
Invoices
INVOICES DUE
| Project Name: |
Invoice No. |
Created By: |
Created Date: |
Total Value: |
|
|
|
INVOICES PAID
| Project Name: |
Invoice No. |
Created By: |
Created Date: |
Total Value: |
|
|
|
close();
?>