Location: PHPKode > projects > PhpMyInventory > pmi281/delete.php
<?
  Include("Includes/global.inc.php");
  checkPermissions(0, 1800);

  $errorMessage = "System error: delete. (info:";

If ($hardwareID) {
  $sql = "DELETE FROM software WHERE hardware_id=$hardwareID AND accountID=$accountID";
  $result = dbqueryWithAlert($sql, $adminEmail, ($errorMessage." Hid: $hardwareID , s)"));

  $sql = "DELETE FROM peripherals WHERE fk_asset=$hardwareID AND accountID=$accountID";
  $result = dbqueryWithAlert($sql, $adminEmail, ($errorMessage." Hid: $hardwareID , p)"));

  $sql = "DELETE FROM hardware WHERE pk_asset=$hardwareID AND accountID=$accountID";
  $result = dbqueryWithAlert($sql, $adminEmail, ($errorMessage." Hid: $hardwareID , h)"));

  fillError("System deleted.");

} ElseIf ($peripheralID) {
  $sql = "DELETE FROM peripherals WHERE pk_peripheral=$peripheralID AND accountID=$accountID";
  $result = dbqueryWithAlert($sql, $adminEmail, ($errorMessage." Pid: $peripheralID)"));

  fillError("Peripheral deleted.");

} ElseIf ($softwareID) {
  $sql = "DELETE FROM software WHERE id=$softwareID AND accountID=$accountID";
  $result = dbqueryWithAlert($sql, $adminEmail, ($errorMessage." Sid: $softwareID)"));

  fillError("Software deleted.");
}

writeHeader("Deleted...");

declareError(TRUE);

writeFooter();
?>
Return current item: PhpMyInventory