本文整理汇总了PHP中USER::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::delete方法的具体用法?PHP USER::delete怎么用?PHP USER::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: operationUser
/**
* Выполняет операцию над отмеченными пользователями в админке.
* @return boolean
*/
public function operationUser()
{
$operation = $_POST['operation'];
if (empty($_POST['users_id'])) {
$this->messageError = 'Необходимо отметить пользователей!';
return false;
}
if ($operation == 'delete') {
foreach ($_POST['users_id'] as $userId) {
$del = USER::delete($userId);
if (!$del) {
$this->messageSucces = 'Удалены отмеченные пользователи, кроме администратора!';
}
}
}
$this->messageSucces = 'Выделенные пользователи удалены!';
return true;
}
示例2: catch
//runs a query depending on the id of the post
$query = $conn->prepare("SELECT userID, title FROM blogpost WHERE blogID = :blogID");
$query->execute(array(":blogID" => $blogID));
$row = $query->fetch(PDO::FETCH_ASSOC);
//if no results, display "Oh,no!"
if ($row == "") {
echo "OH NO";
} else {
//setting variables
$userIdent = $row['userID'];
$title = $row['title'];
}
if (isset($_POST['delete'])) {
//if no errors are found, run update
if ($userID == $userIdent) {
$user->delete($blogID);
$submitted[] = "Deleted! Now wasn't that easy?";
}
}
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}
/*
//when the post has been changed and the user clicks update
*/
?>
<?php
//but we also check if the user is the right user
if ($userID == $userIdent) {
?>