query($query2); while ($row2 = $result2->fetchArray()) { $string = $row2['fullname']; $parts = explode(" ", $string); if ($parts[0] == $createdbyName){ $createEmail = $row2['email']; $createMobile = $row2['mobile']; $createdby = $row2['fullname']; } } $db2->close(); // Check if the projects.db file exists, and if not, create it $dbFile4 = $parentDirectory . '/invoices/database/invoices.db'; if (!file_exists($dbFile4)) { $db = new SQLite3($dbFile4); if (!$db) { die("Failed to create the database file."); } // Create the 'projects' table $createQuery = "CREATE TABLE IF NOT EXISTS figures ( id INTEGER PRIMARY KEY AUTOINCREMENT, item TEXT, description TEXT, subtotal TEXT )"; $db->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, clientname, mobile, email, address, createdby, invoicefull, projectname, createdate, clientid FROM figures"; $result = $db->query($query); $invoiceNumber = $_SESSION['invoiceNumber']; while ($row = $result->fetchArray(SQLITE3_ASSOC)) { if ($invoiceNumber == $row['invoicefull']){ $clientId = $row['clientid']; $clientname = $row['clientname']; $email = $row['email']; $mobile = $row['mobile']; $address = $row['address']; $createdby = $row['createdby']; $projectname = $row['projectname']; $createdate = $row['createdate']; $projectId = $row['id']; $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++) { $items[$i] = str_replace('*B*', ',', $items[$i]); $test = preg_replace('/\*B\*/', ',', $descriptions[$i]); echo ""; echo "" . $items[$i] . ''; echo "" . $test . ''; echo "
R" . $subtotals[$i] . "
"; echo ''; } } } } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["update"])) { $updatedData = $_POST["updatedData"]; $projectId = $_POST["projectId"]; } ?> Invoice
Home'; echo 'Invoices'; // echo 'Client Profile'; echo ''; echo ''; echo ''; ?>





"; ?> "; ?> "; // Connect to the SQLite3 database //echo $mobile; echo ""; ?> "; ?> "; ?> '; echo $createdby; echo ""; echo ''; echo ""; ?> '; echo $createEmail; echo ""; echo ''; echo ""; ?> '; echo $createMobile; echo ""; echo ''; echo ''; ?> "; ?>
Company: Client:
BLACKHOUND ENTERPRISES PTY LTD T/A
BLACKHOUND ARCHITECTURE & RENDERING
Unit 10 - The Network
19 Cactus Road, Fairview, Port Elizabeth
(Gqeberha), Eastern Cape, 6075
Invoice No.:
Item: Description: Sub Total:
Total: (excl. VAT)
R 0.00
Banking Details:
Bank:                       Nedbank
Account Type:         Cheque account
Account Number:    1212774191
Branch Code:          198765
KINDLY USE THE INVOICE NUMBER AS YOUR PAYMENT REFERENCE