本文整理汇总了PHP中delete_record函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_record函数的具体用法?PHP delete_record怎么用?PHP delete_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_write_close
<?php
include_once 'data.php';
include_once 'functions.php';
session_write_close();
if (isset($_GET['file'])) {
$_GET['file'] = intval($_GET['file']);
}
//DELETE BUTTON IN ITEMS VIEW
if (isset($_GET['delete']) && isset($_GET['file']) && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
database_connect(IL_DATABASE_PATH, 'library');
$error = null;
$error = delete_record($dbHandle, $_GET['file']);
die($error);
}
if (isset($_GET['file'])) {
// Fetch ids from cache in history.
database_connect(IL_DATABASE_PATH, 'history');
if ($_SESSION['orderby'] == 'id') {
$result = $dbHandle->query("SELECT itemID FROM `" . $_SESSION['display_files'] . "` WHERE id<=(SELECT id FROM `" . $_SESSION['display_files'] . "` WHERE itemID=" . $_GET['file'] . ")+10 ORDER BY id DESC LIMIT 22");
} else {
$result = $dbHandle->query("SELECT itemID FROM `" . $_SESSION['display_files'] . "` WHERE id>=(SELECT id FROM `" . $_SESSION['display_files'] . "` WHERE itemID=" . $_GET['file'] . ")-10 LIMIT 22");
}
$export_files = array();
if ($result) {
$export_files = $result->fetchAll(PDO::FETCH_COLUMN);
}
$dbHandle = null;
}
//CHECK IF ITEM IS STILL IN LIST AFTER CHANGES AND RELOAD
if (isset($_GET['checkitem']) && isset($_GET['files'])) {
示例2: scorm_seq_set
function scorm_seq_set($what, $scoid, $userid, $attempt = 0, $value = 'true')
{
$sco = scorm_get_sco($scoid);
/// set passed activity to active or not
if ($value == false) {
delete_record('scorm_scoes_track', 'scoid', $scoid, 'userid', $userid, 'attempt', $attempt, 'element', $what);
} else {
scorm_insert_track($userid, $sco->scorm, $sco->id, 0, $what, $value);
}
// update grades in gradebook
$scorm = get_record('scorm', 'id', $sco->scorm);
scorm_update_grades($scorm, $userid, true);
}
示例3: databaseactions
function databaseactions()
{
global $_POST, $MM_editTable, $MM_fieldsStr, $MM_columnsStr, $MM_editRedirectUrl, $MM_editColumn, $MM_recordId;
if ($_POST[MM_insert]) {
$id = insert_record($MM_editTable, $MM_fieldsStr, $MM_columnsStr, $MM_editRedirectUrl);
}
if ($_POST[MM_update] & $_POST[MM_recordId]) {
$id = update_record($MM_editTable, $MM_recordId, $MM_fieldsStr, $MM_columnsStr, $MM_editRedirectUrl);
}
if ($_POST[MM_delete] & $_POST[MM_recordId]) {
delete_record($MM_editTable, $MM_recordId, $MM_editRedirectUrl);
}
return $id;
}
示例4: array
<?php
include_once 'data.php';
include_once 'functions.php';
if (isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
if (!empty($_POST['submit'])) {
if (!isset($_POST['ids'])) {
$_POST['ids'] = array();
}
echo '<div class="details alternating_row" style="font-weight:bold">Number of Deleted Duplicates:</div>' . '<div style="padding:4px 8px">' . count($_POST['ids']) . '</div>' . '<div style="padding:0 8px"><h3>Done.</h3></div>';
// DELETE ITEMS
database_connect($database_path, 'library');
delete_record($dbHandle, $_POST['ids']);
$dbHandle = null;
} elseif (isset($_GET['find_duplicates']) && $_GET['find_duplicates'] == 'similar') {
echo '<div class="details alternating_row" style="font-weight:bold">Possible Duplicates:</div>' . '<div style="padding:4px 8px"><input type="checkbox" style="visibility:hidden">' . '<span style="display:inline-block;margin-left:1em;width:4em">ID</span><span style="margin-left:1em">Title</span></div>';
echo '<form action="duplicates.php" method="POST">';
$duplicates_array = array();
database_connect($database_path, 'library');
$dbHandle->exec("PRAGMA cache_size = 200000");
$dbHandle->exec("PRAGMA temp_store = MEMORY");
$dbHandle->exec("PRAGMA synchronous = OFF");
$dbHandle->exec("CREATE TEMPORARY TABLE search_result (id INTEGER PRIMARY KEY,title)");
$dbHandle->exec("INSERT INTO search_result SELECT id,title FROM library");
$result = $dbHandle->query("SELECT id,title FROM search_result ORDER BY id ASC");
$i = 0;
while ($title = $result->fetch(PDO::FETCH_ASSOC)) {
$title_query = $dbHandle->quote(substr($title['title'], 0, -1) . '%');
$id_result = $dbHandle->query("SELECT id,title FROM search_result WHERE id > {$title['id']} AND lower(title) LIKE lower({$title_query}) LIMIT 1");
$id_result = $id_result->fetch(PDO::FETCH_ASSOC);
if (!empty($id_result['id'])) {
示例5: delete_record
$ret = delete_record($args);
if ($ret !== true) {
output_error($ret);
}
break;
case '/add-record':
$ret = add_record($args);
if ($ret !== true) {
output_error($ret);
}
break;
case '/update-record':
$original = $args['record']['original'];
$new = $args['record']['new'];
$args['record'] = $original;
// output_error(print_r($args));
$ret = delete_record($args);
if ($ret !== true) {
output_error($ret);
}
$args['record'] = $new;
$ret = add_record($args);
if ($ret !== true) {
$args['record'] = $original;
add_record($args);
output_error($ret);
}
break;
default:
output_error('Requested method is not available.', 501);
}
示例6: delete_rhythm
function delete_rhythm($rid)
{
//Delete rhythm
delete_record('rid', $rid, 'nsh_rhythms');
}
示例7: get_zone_id_from_record_id
$perm_content_edit = "own";
} else {
$perm_content_edit = "none";
}
$zid = get_zone_id_from_record_id($_GET['id']);
if ($zid == NULL) {
header("Location: list_zones.php");
exit;
}
$user_is_zone_owner = verify_user_is_owner_zoneid($zid);
$zone_info = get_zone_info_from_id($zid);
if ($record_id == "-1") {
error(ERR_INV_INPUT);
} else {
if ($confirm == '1') {
if (delete_record($record_id)) {
success("<a href=\"edit.php?id=" . $zid . "\">" . SUC_RECORD_DEL . "</a>");
/*
update serial after record deletion
*/
update_soa_serial($zid);
}
} else {
$zone_id = recid_to_domid($record_id);
$zone_name = get_zone_name_from_id($zone_id);
$user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
$record_info = get_record_from_id($record_id);
echo " <h2>" . _('Delete record in zone') . " \"<a href=\"edit.php?id=" . $zid . "\">" . $zone_name . "</a>\"</h2>\n";
if ($zone_info['type'] == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0") {
error(ERR_PERM_EDIT_RECORD);
} else {
示例8: filescategories
$dbHandle->exec("INSERT OR IGNORE INTO filescategories (fileID,categoryID) SELECT itemID, " . intval($cat) . " FROM history.`" . $_SESSION['display_files'] . "` ORDER BY id DESC");
}
$dbHandle->exec("DELETE FROM filescategories WHERE fileID NOT IN (SELECT id from library)");
}
// REMOVE FROM CATEGORIES
if ($_POST['omnitool'] == '9' && !empty($_POST['category'])) {
while (list(, $cat) = each($_POST['category'])) {
$dbHandle->exec("DELETE FROM filescategories WHERE categoryID=" . intval($cat) . " AND fileID IN (SELECT itemID FROM history.`" . $_SESSION['display_files'] . "` ORDER BY id)");
}
}
$dbHandle->commit();
// DELETE ITEMS
if ($_POST['omnitool'] == '8' && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
$result = $dbHandle->query("SELECT itemID FROM history.`" . $_SESSION['display_files'] . "` LIMIT 10000");
$delete_files = $result->fetchAll(PDO::FETCH_COLUMN);
delete_record($dbHandle, $delete_files);
}
$dbHandle = null;
} elseif (isset($_SESSION['auth'])) {
?>
<div>
<table class="threed" cellspacing=0 style="width:100%">
<tr>
<td class="threed select_span omnitooltd" style="width:32%;line-height:22px">
<input type="radio" style="display:none" name="omnitool" value="1">
<i class="fa fa-circle-o"></i>
Save to Shelf
</td>
<td class="threed select_span omnitooltd" style="width:32%;line-height:22px">
<input type="radio" style="display:none" name="omnitool" value="5">
示例9: delete_record
// Create the final message.
if ($PIC_NEED_APPROVAL) {
if ($file_placement == 'no') {
$final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
} else {
$final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
}
} else {
if ($file_placement == 'no') {
$final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
} else {
$final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
}
}
// Delete the temporary data file.
delete_record($_POST['unique_ID']);
// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if ($CONFIG['upl_notify_admin_email'] and $PIC_NEED_APPROVAL) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification()
{
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once 'include/mailer.inc.php';
// Send the message.
cpg_mail('admin', sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . 'editpics.php?mode=upload_approval'));
}
cpg_send_upload_notification();
}
// That was the last one. Create a redirect box.
示例10: ewiki_database_moodle
function ewiki_database_moodle($action, &$args, $sw1, $sw2)
{
global $wiki, $wiki_entry, $CFG;
#-- result array
$r = array();
switch ($action) {
/* Returns database entry as array for the page whose name was given
with the "id" key in the $args array, usually fetches the latest
version of a page, unless a specific "version" was requested in
the $args array.
*/
# Ugly, but we need to choose which wiki we are about to change/read
case "GET":
$id = "'" . anydb_escape_string($args["id"]) . "'";
$version = 0 + @$args["version"] and $version = "AND (version={$version})" or $version = "";
# $result = mysql_query("SELECT * FROM " . EWIKI_DB_TABLE_NAME
# . " WHERE (pagename=$id) $version ORDER BY version DESC LIMIT 1"
#);
#if ($result && ($r = mysql_fetch_array($result, MYSQL_ASSOC))) {
# $r["id"] = $r["pagename"];
# unset($r["pagename"]);
#}
#if (strlen($r["meta"])) {
# $r["meta"] = @unserialize($r["meta"]);
#}
$select = "(pagename={$id}) AND wiki=" . $wiki_entry->id . " {$version} ";
$sort = "version DESC";
if ($result_arr = get_records_select(EWIKI_DB_TABLE_NAME, $select, $sort, "*", 0, 1)) {
//Iterate to get the first (and unique!)
foreach ($result_arr as $obj) {
$result_obj = $obj;
}
}
if ($result_obj) {
//Convert to array
$r = get_object_vars($result_obj);
$r["id"] = $r["pagename"];
unset($r["pagename"]);
$r["meta"] = @unserialize($r["meta"]);
}
break;
/* Increases the hit counter for the page name given in $args array
with "id" index key.
*/
/* Increases the hit counter for the page name given in $args array
with "id" index key.
*/
case "HIT":
#mysql_query("UPDATE " . EWIKI_DB_TABLE_NAME . " SET hits=(hits+1) WHERE pagename='" . anydb_escape_string($args["id"]) . "'");
# set_field does not work because of the "hits+1" construct
#print "DO ".anydb__escape_string($args["id"]); exit;
execute_sql("UPDATE " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " SET hits=(hits+1) WHERE pagename='" . anydb_escape_string($args["id"]) . "' and wiki=" . $wiki_entry->id, 0);
break;
/* Stores the $data array into the database, while not overwriting
existing entries (using WRITE); returns 0 on failure and 1 if
saved correctly.
*/
/* Stores the $data array into the database, while not overwriting
existing entries (using WRITE); returns 0 on failure and 1 if
saved correctly.
*/
case "OVERWRITE":
$COMMAND = "REPLACE";
break;
case "WRITE":
$COMMAND = "WRITE";
$args["pagename"] = $args["id"];
unset($args["id"]);
if (is_array($args["meta"])) {
$args["meta"] = serialize($args["meta"]);
}
#$sql1 = $sql2 = "";
#foreach ($args as $index => $value) {
# if (is_int($index)) {
# continue;
# }
# $a = ($sql1 ? ', ' : '');
# $sql1 .= $a . $index;
# $sql2 .= $a . "'" . anydb_escape_string($value) . "'";
#}
#strlen(@$COMMAND) || ($COMMAND = "INSERT");
foreach ($args as $index => $value) {
if (is_int($index)) {
continue;
}
$args[$index] = anydb_escape_string($value);
}
$args["wiki"] = $wiki_entry->id;
# Check if Record exists
if ($COMMAND == "REPLACE") {
if (count_records(EWIKI_DB_TABLE_NAME, "wiki", $wiki_entry->id, "pagename", $args["pagename"], "version", $args["version"])) {
delete_record(EWIKI_DB_TABLE_NAME, "wiki", $wiki_entry->id, "pagename", $args["pagename"], "version", $args["version"]);
}
}
# Write
$result = insert_record(EWIKI_DB_TABLE_NAME, (object) $args, false);
#$result = mysql_query("$COMMAND INTO " . EWIKI_DB_TABLE_NAME .
# " (" . $sql1 . ") VALUES (" . $sql2 . ")"
#);
#return($result && mysql_affected_rows() ?1:0);
//.........这里部分代码省略.........
示例11: delete_record
}
//DELETE ACTION
if (isset($_GET['delete'])) {
$id = $_GET['delete'];
//sementara delete data tanpa cek ke table lain karna ini cek ke tabel transaksi
//CEK DATA IN other table BEFORE DELETE
// $cek_exist = count_data(TB_PREF."items", 'id', "id_brand='".$id."'");
// if ($cek_exist[0]>0) {
// display_error("Data ini masih digunakan... "
// . "| <a href='?".$parameter_key."kd_tabel=tb_stores' />Close</a>");
// }
// else{
$table = TB_PREF . "stores";
$field_key = "id";
$field_val = "'" . $id . "'";
$query = delete_record($table, $field_key, $field_val);
if ($query) {
display_success("Data berhasil dihapus " . "| <a href='?" . $parameter_key . "kd_tabel=tb_stores' />Close</a>");
} else {
display_error("Gagal menghapus data <br>" . "(" . mysql_error() . ") | <a href='?" . $parameter_key . "kd_tabel=tb_stores' />Close</a>");
}
// }
}
//-------------------------------FORM-----------------------------------------
start_form();
//form input
if (isset($_POST['AddNew'])) {
start_table("class='form'");
text_field('Store Name: ', 'store_name', $val_selected['store_name'], true);
text_area('Description: ', 'description', $val_selected['description']);
text_field('Address: ', 'address', $val_selected['address'], false);
示例12: udutu_seq_set
function udutu_seq_set($what, $scoid, $userid, $attempt = 0, $value = 'true')
{
/// set passed activity to active or not
if ($value == false) {
delete_record('udutu_scoes_track', 'scoid', $scoid, 'userid', $userid, 'element', $what);
} else {
$sco = udutu_get_sco($scoid);
udutu_insert_track($userid, $sco->udutu, $sco->id, 0, $what, $value);
}
}
示例13: borrar_id
function borrar_id($id)
{
delete_record('ejercicios_ierc_resp', 'id', $id);
}
示例14: delete_record
// Create the final message.
if ($PIC_NEED_APPROVAL) {
if ($file_placement == 'no') {
$final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
} else {
$final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
}
} else {
if ($file_placement == 'no') {
$final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
} else {
$final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
}
}
// Delete the temporary data file.
delete_record($superCage->post->getAlnum('unique_ID'));
// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if ($CONFIG['upl_notify_admin_email'] and $PIC_NEED_APPROVAL) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification()
{
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once 'include/mailer.inc.php';
// Send the message.
cpg_mail('admin', sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . 'editpics.php?mode=upload_approval'));
}
cpg_send_upload_notification();
}
// That was the last one. Create a redirect box.
示例15: foreach
}
foreach ($enrolledusers as $user) {
$dataobj = new stdClass();
$dataobj->userid = $user->id;
$dataobj->hostid = $mnet_peer->id;
$dataobj->courseid = $courseid;
$dataobj->rolename = $all_enrolled_users[$user->username]['name'];
$dataobj->enroltype = $all_enrolled_users[$user->username]['enrol'];
if ($user->wehaverecord == 0) {
$dataobj->enroltime = $all_enrolled_users[$user->username]['timemodified'];
$dataobj->id = insert_record('mnet_enrol_assignments', $dataobj);
} elseif (array_key_exists($user->username, $all_enrolled_users)) {
$dataobj->id = $user->enrolid;
update_record('mnet_enrol_assignments', $dataobj);
} elseif (is_array($all_enrolled_users) && count($all_enrolled_users)) {
delete_record('mnet_enrol_assignments', 'id', $user->enrolid);
}
}
unset($enrolledusers);
// Read about our remote enrolments in 2 sets
// first, get the remote enrolments done via enrol/mnet $mnetenrolledusers
// second, get the remote enrolments done with other plugins $remtenrolledusers
// NOTE: both arrays are keyed on the userid!
$sql = "\n SELECT\n u.id,\n u.firstname,\n u.lastname,\n a.rolename,\n a.enroltype,\n a.courseid\n FROM\n {$CFG->prefix}user u,\n {$CFG->prefix}mnet_enrol_assignments a\n WHERE\n a.userid = u.id AND \n a.courseid={$courseid} AND\n a.enroltype = 'mnet' AND\n u.deleted = 0 AND\n u.confirmed = 1 AND\n u.mnethostid = {$CFG->mnet_localhost_id}\n ORDER BY\n u.firstname ASC,\n u.lastname ASC";
if (!($mnetenrolledusers = get_records_sql($sql))) {
$mnetenrolledusers = array();
}
$sql = "\n SELECT\n u.id,\n u.firstname,\n u.lastname,\n a.rolename,\n a.enroltype,\n a.courseid\n FROM\n {$CFG->prefix}user u,\n {$CFG->prefix}mnet_enrol_assignments a\n WHERE\n a.userid = u.id AND \n a.courseid={$courseid} AND\n a.enroltype != 'mnet' AND\n u.deleted = 0 AND\n u.confirmed = 1 AND\n u.mnethostid = {$CFG->mnet_localhost_id}\n ORDER BY\n u.firstname ASC,\n u.lastname ASC";
if (!($remtenrolledusers = get_records_sql($sql))) {
$remtenrolledusers = array();
}