本文整理汇总了PHP中Delete函数的典型用法代码示例。如果您正苦于以下问题:PHP Delete函数的具体用法?PHP Delete怎么用?PHP Delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeleteAll
function DeleteAll(array $obj)
{
$res = true;
foreach ($obj as $item) {
$table = GetTabelByModel($item);
$res &= Delete($table, $item);
}
return $res;
}
示例2: Delete
function Delete($directory)
{
foreach (glob("{$directory}/*") as $file) {
if (is_dir($file)) {
Delete($file);
} else {
unlink($file);
}
}
rmdir($directory);
}
示例3: Delete
function Delete($path)
{
if (is_dir($path) === true) {
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
Delete(realpath($path) . '/' . $file);
}
return rmdir($path);
} else {
if (is_file($path) === true) {
return unlink($path);
}
}
return false;
}
示例4: DeleteUser
function DeleteUser($config, $id)
{
$rows = array();
switch ($config['adapter']) {
case 'Mysql':
include '../modules/Application/src/Application/Model/Mysql/Execute.php';
include '../modules/Application/src/Application/Model/Mysql/Connect.php';
$link = Connect($config['slave']);
$query = "DELETE FROM user WHERE iduser=" . $id;
$rows = Execute($link, $query);
break;
case 'Txt':
include '../modules/Application/src/Application/Model/Txt/Delete.php';
$rows = Delete($id, $config['userfilename']);
break;
}
return $rows;
}
示例5: DeleteUser
function DeleteUser($config, $id)
{
switch ($config['adapter']) {
case 'Mysql':
include "../modules/Application/src/Application/Model/Mysql/Connect.php";
include "../modules/Application/src/Application/Model/Mysql/Execute.php";
$master = $config['dbmaster'];
$slave = $config['dbslave'];
$link = Connect($master);
$query = "DELETE FROM user WHERE iduser='" . $id . "'";
$data = Execute($query, $link);
break;
case 'Txt':
include "../modules/Application/src/Application/Model/Txt/Delete.php";
$data = Delete($config['filename'], $id);
break;
}
return $data;
}
示例6: array
if (isset($_POST['submit']) == 'Submit') {
$data = array('category_id' => 0, 'user_id' => $_SESSION['id'], 'category_name' => mysql_real_escape_string($_POST['category']), 'status' => 1, 'date' => date('Y-m-d'));
//dbRowInsert('video_category', $data);
$output = InsertPDO('video_category', $data);
} else {
?>
<form method="post" name="myform" onSubmit="return validform();">
<label for="email"><span>Category Name: </span><input type="text" name="category" value="" /></label>
<label><span></span><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Cancel" /></label>
</form>
<?php
}
?>
<?php
if (!empty($_GET['delete'])) {
Delete('video_category', 'category_id', $_GET['delete']);
header('Location: video-category.php');
}
$query = "SELECT category_id, category_name, date, status FROM video_category WHERE user_id=:user_id";
$res = $dbh->prepare($query);
$res->bindValue(':user_id', $_SESSION['id'], PDO::PARAM_INT);
$res->execute();
$sn = 1;
?>
<table border="1" width="100%">
<tr><th>S.N.</th><th>Name</th><th>Date</th><th>Status</th><th>Edit</th><th>Delete</th></tr>
<?php
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
echo "<tr><td>{$sn}</td><td class='cat-name'>" . $row['category_name'] . "</td><td>" . $row['date'] . "</td><td>" . $row['status'] . "</td><td><a href=\"#\" rel=\"" . $row['category_id'] . "\" class=\"edit\">edit</p></td><td><a onclick=\"return confirm('Are you sure you want to delete?')\" href=\"video-category.php?delete=" . $row['category_id'] . "\">Delete</a></td></tr>";
$sn++;
}
示例7: execute
function execute($param, $post)
{
if (count($param) > 0 && $param[0] == "act") {
$obj = json_decode($post["json"]);
$group = GetSingleByCondition(DRINKERCYCLE_TABLE, array("Name" => $obj->Name));
if ($group instanceof DrinkerCycle) {
if ($obj->Action == "exists") {
$groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id));
return ReturnBoolean($groupRela != null);
} else {
if ($obj->Action == "add") {
$drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
if ($drinker instanceof Drinker) {
$presGroupRelation = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
if ($presGroupRelation == null) {
$groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id));
$newRela = new DrinkerCyclesDrinkersRelation();
$newRela->DrinkerId = $drinker->Id;
$newRela->DrinkerCycleId = $group->Id;
$newRela->IsAuthenticated = $groupRela == null;
return ReturnBoolean(Insert(DRINKERCYCLESDRINKERSRELATION_TABLE, $newRela));
}
return ReturnBoolean(true);
} else {
return ReturnNotFound($obj->Guid, "Drinker");
}
} else {
if ($obj->Action == "remove") {
$drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
if ($drinker instanceof Drinker) {
$groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
if ($groupRela instanceof DrinkerCyclesDrinkersRelation) {
return ReturnBoolean(DeleteById(DRINKERCYCLESDRINKERSRELATION_TABLE, $groupRela->Id));
} else {
return RelationNotFound($group->Id, $drinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
}
} else {
return ReturnNotFound($obj->Guid, DRINKER_TABLE);
}
} else {
if ($obj->Action == "authenticate" || $obj->Action == "deauthenticate") {
$newVal = true;
if ($obj->Action == "deauthenticate") {
$newVal = false;
}
$drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
if ($drinker instanceof Drinker) {
$groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
if ($groupRela instanceof DrinkerCyclesDrinkersRelation) {
//can change others status
if ($groupRela->IsAuthenticated) {
$otherDrinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->AuthGuid));
if ($otherDrinker instanceof Drinker) {
$otherGroupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $otherDrinker->Id));
if ($otherGroupRela instanceof DrinkerCyclesDrinkersRelation) {
$otherGroupRela->IsAuthenticated = $newVal;
return ReturnBoolean(Update(DRINKERCYCLESDRINKERSRELATION_TABLE, $otherGroupRela));
} else {
return RelationNotFound($group->Id, $otherDrinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
}
} else {
return ReturnNotFound($obj->AuthGuid, "Drinker");
}
} else {
//not authenticated
return ReturnBoolean(false);
}
} else {
return RelationNotFound($group->Id, $drinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
}
} else {
return ReturnNotFound($obj->Guid, "Drinker");
}
} else {
if ($obj->Action == "removeforeign") {
$drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
if ($drinker instanceof Drinker) {
$groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
if ($groupRela instanceof DrinkerCyclesDrinkersRelation) {
//can change others status
if ($groupRela->IsAuthenticated) {
$otherDrinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->AuthGuid));
if ($otherDrinker instanceof Drinker) {
$otherGroupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $otherDrinker->Id));
if ($otherGroupRela instanceof DrinkerCyclesDrinkersRelation) {
return ReturnBoolean(Delete(DRINKERCYCLESDRINKERSRELATION_TABLE, $otherGroupRela));
} else {
return RelationNotFound($group->Id, $otherDrinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
}
} else {
return ReturnNotFound($obj->AuthGuid, "Drinker");
}
} else {
//not authenticated
return ReturnBoolean(false);
}
} else {
return RelationNotFound($group->Id, $drinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
}
} else {
//.........这里部分代码省略.........
示例8: AddForm
$location = $_GET["location"];
} else {
$location = $_POST["location"];
}
/* check the action */
if ($action == "addform") {
AddForm("", $name, $description, $location);
}
if ($action == "add") {
Add($name, $description, $location);
} elseif ($action == "editform") {
EditForm("", $id);
} elseif ($action == "edit") {
Edit($id, $name, $description, $location);
} elseif ($action == "delete") {
Delete($id);
} elseif ($action == "" || $action == "list") {
DisplayList();
}
/* ----------------------------------------------- */
/* --------- DisplayList ------------------------- */
/* ----------------------------------------------- */
function DisplayList()
{
?>
<style>
.header { font-weight: bold; color: darkblue; border-top: 2px solid gray; border-bottom: 1px solid gray;}
</style>
<table><tr><td><img src="images/back16.png"></td><td><a href="index.php" class="link">Back</a> to Calendar</td></tr></table><br>
<br>
<table width="100%">
示例9: header
header("Location: /UserController.php");
} else {
// Formulario relleno con los datos
$id = $_GET['id'];
$_GET['filename'] = 'user.txt';
include "../modules/Application/views/user/update.phtml";
}
break;
case 'select':
// Leer el archivo de texto en un string
$users = file_get_contents('user.txt');
// convertir el string en array separando por saltos de linea
$users = explode("\n", $users);
include "../modules/Application/views/user/select.phtml";
break;
case 'delete':
if ($_POST) {
if ($_POST['submit'] == 'si') {
include "../modules/Application/src/Application/Model/Txt/Delete.php";
Delete($_POST['id'], 'user.txt');
}
// Saltar a select
header("Location: /UserController.php");
} else {
// Formulario de si/no para user id
$id = $_GET['id'];
$name = $_GET['id'];
include "../modules/Application/views/user/delete.phtml";
}
break;
}
示例10: DisplayForm
/* check the action */
if ($action == "addform") {
DisplayForm("", "", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate);
}
if ($action == "add") {
Add("add", "", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, 0);
} elseif ($action == "editform") {
DisplayForm($id, "", "", "", "", "", "", "", "", "", "", "", $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate);
} elseif ($action == "edit") {
Add("update", $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, 0);
} elseif ($action == "editall") {
Add("update", $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, 1);
} elseif ($action == "delete") {
Delete($id, $currentcal, 0);
} elseif ($action == "deleteall") {
Delete($groupid, $currentcal, 1);
} elseif ($action == "cancel") {
Cancel($id, $currentcal, $cancelreason, $notifyusers, 0);
} elseif ($action == "cancelall") {
Cancel($groupid, $currentcal, $cancelreason, $notifyusers, 1);
} elseif ($action == "" || $action == "list") {
//DisplayList();
echo "Nothing to do";
}
/* ----------------------------------------------- */
/* --------- Add --------------------------------- */
/* ----------------------------------------------- */
function Add($method, $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, $editall)
{
/* check if any form elements are bad, if so redisplay the addform */
if ($title == "") {
示例11: usersMenus
<?php
if(isset($_GET["verbose"])){ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string','');}
include_once('ressources/class.templates.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.mysql.inc');
include_once('ressources/class.squid.acls.inc');
include_once('ressources/class.squid.inc');
$users=new usersMenus();
if(!$users->AsDansGuardianAdministrator){die();}
if(isset($_GET["events"])){popup_list();exit;}
if(isset($_GET["popup"])){popup();exit;}
if(isset($_POST["delete"])){Delete();exit;}
if(isset($_GET["add-www-js"])){add_www_js();exit;}
if(isset($_GET["add-nocache-js"])){add_nocache_js();exit;}
if(isset($_GET["add-nocache-popup"])){add_nocache_popup();exit;}
if(isset($_GET["add-white-popup"])){add_white_popup();exit;}
if(isset($_GET["add-white-tab"])){add_white_tab();exit;}
if(isset($_GET["add-black-js"])){add_black_js();exit;}
if(isset($_GET["add-black-popup"])){add_black_popup();exit;}
if(isset($_POST["blacklist"])){add_black_save();exit;}
if(isset($_POST["whitelist"])){add_white_save();exit;}
if(isset($_POST["nocache"])){add_nocache_save();exit;}
if(isset($_POST["whitelist-single"])){add_white_single();exit;}
js();
示例12: mysql_escape_string
$page = mysql_escape_string($_GET['page']);
}
if ($page) {
$start = ($page - 1) * $limit;
} else {
$start = 0;
}
$cat_qry = "SELECT * FROM tbl_news_category ORDER BY tbl_news_category.cid LIMIT {$start}, {$limit}";
$cat_result = mysql_query($cat_qry);
if (isset($_GET['cat_id'])) {
$img_res = mysql_query('SELECT * FROM tbl_news_category WHERE cid=\'' . $_GET['cat_id'] . '\'');
$img_row = mysql_fetch_assoc($img_res);
if ($img_row['category_image'] != "") {
unlink('upload/category/' . $img_row['category_image']);
}
Delete('tbl_news_category', 'cid=' . $_GET['cat_id'] . '');
$_SESSION['msg'] = "7";
header("Location:category");
exit;
}
//Active and Deactive status
if (isset($_GET['status_deactive_id'])) {
$data = array('status' => '0');
$edit_list = Update('tbl_news_category', $data, "WHERE cid = '" . $_GET['status_deactive_id'] . "'");
$_SESSION['msg'] = "9";
header("Location:category");
exit;
}
if (isset($_GET['status_active_id'])) {
$data = array('status' => '1');
$edit_list = Update('tbl_news_category', $data, "WHERE cid = '" . $_GET['status_active_id'] . "'");
示例13: file_get_contents
} else {
// Formulario relleno con los datos
$id = $router['params']['id'];
$_GET['filename'] = $userfilename;
include "../modules/Application/views/user/update.phtml";
}
break;
case 'index':
case 'select':
// Leer el archivo de texto en un string
$users = file_get_contents($userfilename);
// convertir el string en array separando por saltos de linea
$users = explode("\n", $users);
include "../modules/Application/views/user/select.phtml";
break;
case 'delete':
if ($_POST) {
if ($_POST['submit'] == 'si') {
include "../modules/Application/src/Application/Model/Txt/Delete.php";
Delete($_POST['id'], $userfilename);
}
// Saltar a select
header("Location: /user/select");
} else {
// Formulario de si/no para user id
$id = $router['params']['id'];
$name = $router['params']['id'];
include "../modules/Application/views/user/delete.phtml";
}
break;
}
示例14: execute
function execute($param, $post)
{
if (count($param) > 0) {
if ($param[0] == "act") {
$obj = json_decode($post["json"]);
$user = GetByGuid("Drinker", $obj->Guid);
if ($obj->Action == "exists") {
return ReturnBoolean($user != null);
} else {
if ($obj->Action == "update") {
if ($user instanceof Drinker) {
$user->Name = $obj->UserInformations->Name;
$user->Color = $obj->UserInformations->Color;
return ReturnBoolean(Update(DRINKER_TABLE, $user));
} else {
$user = new Drinker();
$user->Name = $obj->UserInformations->Name;
$user->Color = $obj->UserInformations->Color;
$user->Guid = $obj->Guid;
return ReturnBoolean(Insert(DRINKER_TABLE, $user));
}
} else {
if ($obj->Action == "remove") {
if ($user instanceof Drinker) {
//remove all DrinkerCycleRelations
$relations = GetAllByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerId" => $user->Id));
if (DeleteAll($relations)) {
return ReturnBoolean(Delete(DRINKER_TABLE, $user));
} else {
return ReturnCrudError($relations, "DeleteAll");
}
} else {
return ReturnNotFound($obj->Guid, "Drinker");
}
}
}
}
} else {
if (ValidateGuid($param[0])) {
$user = GetByGuid("Drinker", $param[0]);
if ($user instanceof Drinker) {
$drinker = new DrinkerEntity($user);
$relations = GetAllByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerId" => $drinker->Id));
foreach ($relations as $relation) {
if ($relation instanceof DrinkerCyclesDrinkersRelation) {
$cycle = GetById(DRINKER_TABLE, $relation->DrinkerCycleId);
if ($cycle instanceof DrinkerCycle) {
if ($relation->IsAuthenticated) {
$drinker->AuthDrinkerCycles[] = $cycle->Guid;
} else {
$drinker->NonAuthDrinkerCycles[] = $cycle->Guid;
}
}
}
}
$resp = new DrinkerResponse();
$resp->Drinker = $drinker;
return json_encode($resp);
} else {
return ReturnNotFound($param[0], "Drinker");
}
}
}
}
return ReturnError(LINK_INVALID);
}
示例15: header
<?php
require 'logic/CoreLogic.php';
if (!isset($_GET['id'])) {
header("Location:index.php");
}
$id = "";
$id = $_GET['id'];
loginChek($link);
if (isset($_POST['id'])) {
Delete($link);
} else {
$pagecontent = getSingleRecord($link);
}
require 'templates/header.php';
require 'templates/remove.php';
require 'templates/footer.php';