本文整理汇总了PHP中customer::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP customer::delete方法的具体用法?PHP customer::delete怎么用?PHP customer::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类customer
的用法示例。
在下文中一共展示了customer::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id = 0)
{
if ($id != 0) {
// Create and delete customer
$customer = new customer($id);
$customer->delete();
} else {
$database = $_SESSION['database'];
$id = $database->prepare_input($id);
$customer_query = $database->query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $this->id . "'");
// Reset id, otherwise one might think this customer (still) exists in db
$this->id = 0;
}
}
示例2: customer
$customerInst = new customer();
#######################################################################
## perform action
$status = 1;
if (tool::securePost('action') == "save" && tool::securePost('id')) {
# fill customer with submitted data
$customerInst->id = tool::securePost('id');
$customerInst->fill(tool::securePostAll());
$status = $customerInst->update();
} elseif (tool::securePost('action') == "save") {
$customerInst->fill(tool::securePostAll());
$status = $customerInst->insert();
}
if (tool::securePost('action') == "delete") {
$customerInst->id = tool::securePost('id');
$customerInst->delete();
}
if (tool::securePost('action') == "edit") {
$status = 0;
$customerInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form
if (!$status) {
echo "<h2>" . $lang['common_editRecord'] . " (<a href=\"" . $toolInst->encodeUrl("index.php?content=" . $content) . "\">" . $lang['common_newRecord'] . "</a>)</h2>\n";
} else {
$customerInst->clear();
echo "<h2>" . $lang['common_newRecord'] . "</h2>\n";
}
?>
示例3: database
<?php
if ($_POST) {
include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/customer.php';
$database = new database();
$db = $database->getConnection();
$customer = new customer($db);
$customer->cust_kode = $_POST['object_id'];
if ($customer->delete()) {
echo "customer berhasil dihapus.";
} else {
echo "customer tidak bisa dihapus.";
}
}