if ($_stmt->errno) { onErrorInternal("editPinkieExpenses::editUpdate()", $_stmt->error); } $_stmt->close(); // Close up the database connection. $_db->close(); echo "OKAY"; logGeneral($_POST['pinkieID'], $_SESSION['Username'], "Expense was edited by: " . getName()); return; } if (strcmp($_POST['mode'], "add") == 0) { if (strlen($_POST['pinkieId']) == 0) { // No pinkieId was set. return; } $_db = getMysqli(); $_sql = "INSERT INTO Expenses (PinkieID, Amount, FundID) Values(?,?,?)"; $_stmt = $_db->prepare((string) $_sql); $_stmt->bind_param('idi', $_POST['pinkieID'], $_POST['fundAmt'], $_POST['fundID']); $_stmt->execute(); if ($_stmt->errno) { onErrorInternal("editPinkieExpenses::editAdd()", $_stmt->error); } $_stmt->close(); // Close up the database connection. $_db->close(); echo "OKAY"; logGeneral($_POST['pinkieID'], $_SESSION['Username'], "Expense was added by: " . getName()); return; } echo "ERROR. Invalid Mode!";
if ($_stmt->errno) { onErrorInternal("editPinkiePurchaseObject::edit()", $_stmt->error); } $_stmt->close(); // Close up the database connection. $_db->close(); echo "OKAY"; logGeneral($_POST['pinkieID'], $_SESSION['Username'], "Purchase Object was edited by: " . getName()); return; } if (strcmp($_POST['mode'], "add") == 0) { if (strlen($_POST['pinkieID']) == 0) { // No pinkieID was set. return; } $_db = getMysqli(); $_sql = "INSERT INTO Expenses (PinkieID, Quantity, Description, UnitPrice) Values(?,?,?,?)"; $_stmt = $_db->prepare((string) $_sql); $_stmt->bind_param('iisd', $_POST['pinkieID'], $_POST['quantity'], $_POST['description'], $_POST['unitPrice']); $_stmt->execute(); if ($_stmt->errno) { onErrorInternal("editPinkiePurchaseObject::add()", $_stmt->error); } $_stmt->close(); // Close up the database connection. $_db->close(); echo "OKAY"; logGeneral($_POST['pinkieID'], $_SESSION['Username'], "Purcahse Object was added by: " . getName()); return; } echo "ERROR. Invalid Mode!";