本文整理汇总了PHP中medoo::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP medoo::delete方法的具体用法?PHP medoo::delete怎么用?PHP medoo::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类medoo
的用法示例。
在下文中一共展示了medoo::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete record
* @param int|string $id
* @return bool True in case of success
* @throws \Exception
*/
public function delete($id, $extCall = false)
{
$this->gp->checkAccess(__FUNCTION__, $extCall);
$parsed_arg = $this->checkArguments($id);
if (is_numeric($parsed_arg) !== true) {
throw new \Exception("Argumunt is not a string", 6024);
}
if ($this->isImplement("FileManage")) {
$this->deleteFile($parsed_arg);
}
if (EMA_DEBUG && EMA_LOG_SQL_QUERIES) {
$this->logDeleteQuery($this->dbTable, array("id" => $parsed_arg));
}
$dbData = $this->dbConnection->delete($this->dbTable, array("id" => $parsed_arg));
if (is_numeric($dbData) === false || $dbData < 1) {
$this->throwMysqlError();
}
if ($this->isImplement("Sitemap")) {
$this->generateSitemap();
}
if ($this->isImplement("RssFeed")) {
$this->rssFeedUpdate();
}
return true;
}
示例2: medoo
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once 'meedoo.php';
require_once 'config.php';
$database = new medoo();
// echo 'Request: ' . $_SERVER['REQUEST_METHOD'].'. ';
$mealID = $_GET['mealID'];
$del = $database->delete("meals", ["AND" => ["mealID" => $mealID]]);
if ($del) {
echo 'good';
} else {
echo 'bad';
}
示例3: while
$p = 1;
while ($k < $t) {
$result = mysql_query("SELECT * FROM feedback WHERE question_id='{$q_id[$k]}'") or die(mysql_error());
$resp = array("question" => $question[$k], "one" => "0", "two" => "0", "three" => "0", "four" => "0", "five" => "0", "six" => "0");
if ($type[$k] == "radio") {
while ($row = mysql_fetch_array($result)) {
$resp[$row['answer']]++;
}
$p++;
fputcsv($output, $resp);
}
$k++;
}
//reset feedback data
$db = new medoo($config['db']);
$db->delete('feedback', ['courseid' => $_GET['courseid']]);
$db->update('student_course', ['done' => 0], ['course' => $_GET['courseid']]);
} else {
?>
<!doctype html>
<html>
<head>
<title>Feedback Statistics</title>
<script src="<?php
echo $config['url']['base_url'] . $config['js_includes']['jquery'];
?>
"></script>
<script src="Chart.js"></script>
<link rel="stylesheet" href="accr.css" />
示例4: medoo
<?php
/**
* Created by PhpStorm.
* User: KeenSting
* Date: 2015/7/7
* Time: 13:09
*/
session_start();
$did = $_SESSION['did'];
$id = $_POST['depart'];
include './parameter/Medoo/Resource/medoo.php';
$mydb = new medoo('meetingmanage');
//换部门
$mydb->update('user', array('DEPART_ID' => $id), array('DEPART_ID' => $did));
//删除部门
$mydb->delete('departs', array('DEPART_ID' => $did));
?>
<html>
<head>
</head>
<body>
<script>
alert("部门人员已经转移,部门已从列表中删除!");
</script>
<meta http-equiv="refresh" content="1;href='./delDepart.php'";
</body>
</html>
示例5: delete
/**
* @param $table
* @param $where
* @return bool|int
*/
public function delete($table, $where)
{
return parent::delete($this->prefix . $table, $where);
}
示例6: medoo
session_start();
header("Content-type:text/html; charset=utf8");
include 'medoo/medoo.php';
$database = new medoo();
if (@$_POST['depart']) {
$depart = $_POST['depart'];
if ($depart != "日新网") {
$manager = $database->select("user", array("id", "name", "sex", "college", "depart", "center"), array("depart" => $depart));
} else {
$manager = $database->select("user", array("id", "name", "sex", "college", "depart", "center"));
}
} else {
$manager = $database->select("user", array("id", "name", "sex", "college", "depart", "center"));
}
$result = array();
if ($manager) {
$result["state"] = "success";
$result["message"] = "all done";
$result["info"] = $manager;
$json_result = json_encode($result);
echo $json_result;
} else {
$result["state"] = "error";
$result["message"] = "ERROR:Sql flase";
$json_result = json_encode($result);
echo $json_result;
}
if (@$_POST['id']) {
$id = $_POST['id'];
$database->delete("user", array("id" => $id));
}
示例7: delete
/**
* @param string $table
* @param array $where
* @return bool|int
*/
public function delete($table, $where)
{
$re = parent::delete($table, $where);
$this->lastSql = $this->last_query();
$this->lastError = $this->error();
return $re;
}
示例8: htmlspecialchars
$_SESSION["allOP"] = $allOP;
}
if ("addOP" === $action) {
$opid = htmlspecialchars($_GET["opid"]);
$opname = htmlspecialchars($_GET["opname"]);
$limit = htmlspecialchars($_GET["limit"]);
$database->insert("gr_op", ["opid" => $opid, "opname" => $opname, "pw" => "123", "privilege" => $limit]);
listOP();
header("location: ../../op.php");
}
if ("delOP" === $action) {
$opid = htmlspecialchars($_GET["id"]);
$opname = $database->select("gr_op", "opname", ["opid" => $opid]);
$op = $database->select("gr_charge", "opname", ["opname" => $opname, "LIMIT" => 1]);
if (count($op) == 0) {
$database->delete("gr_op", ["opid" => $opid]);
listOP();
header("location: ../../op.php");
} else {
header("location: ../../op.php?error=true");
}
}
if ("modifyOP" === $action) {
$opname = htmlspecialchars($_GET["opname"]);
$privilege = htmlspecialchars($_GET["limit"]);
$opid = htmlspecialchars($_GET["opid"]);
$database->update("gr_op", ["opname" => $opname, "privilege" => $privilege], ["opid" => $opid]);
listOP();
header("location: ../../op.php");
}
if ("listAllStyle" === $action) {
示例9: deleteRelationTable
/**
* 针对MYSQL级联操作无法触发级联操作的BUG
* @param int $comment_id 评论ID
* @param string $table 对应的数据表
* @param \medoo $db_writer 数据库操作的引用
*/
private function deleteRelationTable($comment_id, $table, &$db_writer)
{
if ($db_writer->delete($table, ['comments_id' => $comment_id]) === false) {
$db_writer->pdo->rollBack();
$this->throwMsg(-1);
}
}
示例10: medoo
<?php
/**
* Created by PhpStorm.
* User: KeenSting
* Date: 2015/10/14
* Time: 14:20
*/
require_once '../../../medoo/medoo.php';
session_start();
$key = $_POST['key'];
$db = new medoo();
$item = $db->select('ambassador', '*', array('ekey' => $key));
$item[0]['operator'] = $_SESSION['userinfo']['ekey'];
//记录操作者的邀请码
$db->insert('d_user', $item[0]);
$re = $db->delete('ambassador', array('ekey' => $key));
unset($db);
if ($re == 1) {
echo 'ok';
} else {
echo 'error';
}
示例11: isset
// Match confirmation against a user's email.
$confirmation = isset($_GET['code']) ? $_GET['code'] : '';
$datas = $database->select("users_pw_reset", "*", ["code" => $confirmation]);
foreach ($datas as $data) {
$code = $data["email"];
}
if (isset($code)) {
// Display a password reset form here.
echo 'Reset your password <hr/>' . $code;
if (isset($_POST['password'])) {
// Update the user's account to the new password.
$new_password = password_hash($_POST['password'], PASSWORD_DEFAULT) . "";
$database->update("users2", ["password" => $new_password], ["email" => $code]);
// update($table, $data, $where)
// Remove the confirmation code.
$database->delete("users_pw_reset", ["AND" => ["code" => $confirmation]]);
echo '<br> Your new password is set!';
userLogin($code);
} else {
echo '
<form method="POST" action="">
<input type="password" name="password" placeholder="Password" /> <br>
<button type="submit">Reset »</button>
</form>
';
}
} else {
echo 'Sorry, this reset link is no longer valid. <a href="?a=forgotten">Request another.</a>';
}
break;
// NEW USER REGISTRATION
示例12: delete
/**
* @param $table
* @param $where
* @return int
*/
public function delete($table, $where)
{
return $this->_writer->delete($table, $where);
}
示例13: function
$datas = $database->update("AdressBook", ["username" => $data['username'], "password" => $data['password']], ["AND" => ["id[=]" => $addressbookid, "candidate[=]" => $candidate]]);
if ($datas) {
//echo $database->last_query();
//header("Content-Type: application/json");
//echo json_encode($datas, JSON_PRETTY_PRINT);
//echo json_encode($datas);
$app->response->headers->set('Content-Type', 'application/json');
$app->response->setBody(json_encode($datas));
} else {
$app->response->headers->set('HTTP/1.1', '404');
}
});
$app->delete('/:candidate/:addressbookid/', function ($candidate, $addressbookid) use($app, &$database) {
$body = $app->request()->getBody();
$data = json_decode($body, true);
$datas = $database->delete("AdressBook", ["AND" => ["id[=]" => $addressbookid, "candidate[=]" => $candidate]]);
if ($datas) {
//echo $database->last_query();
//header("Content-Type: application/json");
//echo json_encode($datas, JSON_PRETTY_PRINT);
//echo json_encode($datas);
$app->response->headers->set('Content-Type', 'application/json');
$app->response->setBody(json_encode($datas));
} else {
$app->response->headers->set('HTTP/1.1', '404');
}
});
$app->get('/:candidate/:addressbookid/groups/:contactgroupid/', function ($candidate, $addressbookid, $contactgroupid) use($app, &$database) {
//echo "GET {$candidate}/{$addressbookid}/groups/{$contactgroupid}\n";
$datas = $database->select("ContactGroup", ["name", "description", "pictureURL"], ["AND" => ["id_adressbook[=]" => $addressbookid, "id_group[=]" => $contactgroupid]]);
if ($datas) {
示例14: medoo
$database = new medoo(['database_type' => 'mysql', 'database_name' => 'r8db', 'server' => '172.16.2.109', 'username' => 'admin', 'password' => 'admin', 'charset' => 'utf8']);
$user_id = $database->select("user", ["[>]entry" => "user_id"], ["entry.entry_id"], ["entry_id" => 10]);
$user = $database->get('user', ['[>]entry' => "user_id"], ['user_id', 'email', 'username', 'admin', 'nsfw'], ['entry_id' => 10]);
$html = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"><div class="container"><div class="row">';
$html .= '<form class="clearfix" method="get">
<div class="form-group col-sm-4"><label for="action">Action</label><select class="form-control" name="action" id="action"><option value="show">show</option><option value="delete">delete</option><option value="add">add</option><option value="set">set</option></select></div>
<div class="form-group col-sm-4"><label for="amount">Amount</label><input class="form-control" type="number" name="amount" id="amount" value=""></div>
<div class="form-group col-sm-4"><label>Functions</label><div><button type="submit" class="btn btn-primary">Submit</button> <button type="reset" class="btn btn-warning">Reset</button></div></div>
</form>';
$html .= '</div><div class="row"><div class="col-sm-12">';
$count = $database->count('entry');
$database->query('ALTER TABLE "entry" AUTO_INCREMENT = ' . ($count + 1));
if (isset($_GET['action'])) {
$amount = isset($_GET['amount']) && is_numeric($_GET['amount']) ? intval($_GET['amount']) : 100;
if ($_GET['action'] == 'delete' && $count != 0) {
$database->delete('entry', ['ORDER' => 'entry_id DESC', 'LIMIT' => $amount]);
} elseif ($_GET['action'] == 'delete') {
$html .= 'Where nothing is, nothing can be removed.';
} elseif ($_GET['action'] == 'add') {
for ($i = $count + 1; $i < $count + $amount + 1; ++$i) {
$data = ['user_id' => 1, 'category_id' => 1, 'title' => 'Dummy #' . $i, 'desc' => 'Lorem Ipsum', 'image' => 'https://placehold.it/400x400'];
$database->insert('entry', $data);
}
} elseif ($_GET['action'] == 'set') {
$database->delete('entry', ['LIMIT' => 99999999999999]);
$count = $database->count('entry');
$database->query('ALTER TABLE "entry" AUTO_INCREMENT = 1');
for ($i = $count + 1; $i < $count + $amount + 1; ++$i) {
$data = ['user_id' => 1, 'category_id' => 1, 'title' => 'Dummy #' . $i, 'desc' => 'Lorem Ipsum', 'image' => 'https://placehold.it/700x350'];
$database->insert('entry', $data);
}
示例15: loginHandler
<?php
require_once '../config.php';
require_once BASE_PATH . '/medoo.min.php';
require_once BASE_PATH . '/login_handler.php';
/*
Login handling and permission check
*/
$login = new loginHandler($config);
if (!$login->is_logged_in()) {
$login->redirect_login('Please login');
}
if ($login->get_user_type() != 'admin') {
$login->not_authorized_error();
}
if (isset($_GET['courseid'])) {
$courseid = $_GET['courseid'];
//delete from courses
$db = new medoo($config['db']);
$db->delete('courses', ['courseid' => $courseid]);
//delete from student course linkage
$db->delete('student_course', ['course' => $courseid]);
//delete question
$db->delete('questions', ['courseid' => $courseid]);
//delete feedback
$db->delete('feedback', ['courseid' => $courseid]);
}
//redirect to course list
header('Location: ' . $config['url']['base_url'] . $config['url']['admin_course_list']);