本文整理汇总了PHP中deleteRecord函数的典型用法代码示例。如果您正苦于以下问题:PHP deleteRecord函数的具体用法?PHP deleteRecord怎么用?PHP deleteRecord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deleteRecord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createGrid
function createGrid($tablename, $fields)
{
connectToDb();
if (isset($_POST['submitDelete'])) {
deleteRecord($_POST['hfRecordID'], $tablename);
}
$queryFields = '';
$grid = '<table border="1"><tr>';
foreach ($fields as $index => $value) {
if (end($fields) == $value) {
$queryFields .= "{$index} ";
} else {
$queryFields .= "{$index}, ";
}
$grid .= "<td>{$value}</td>";
}
$grid .= '<td>دستورات</td>';
$grid .= '</tr>';
$query = "SELECT {$queryFields} FROM {$tablename}";
$result = mysql_query($query);
while ($radif = mysql_fetch_assoc($result)) {
$grid .= '<tr>';
foreach ($radif as $value) {
$grid .= "<td>{$value}</td>";
}
$grid .= "\n <td>\n <form action='' method='post'>\n <input type='hidden' value='{$radif['id']}' name='hfRecordID' />\n <input onclick='return confirm(\"آیای از حذف رکورد مطمئنید?\")' type='submit' value='حذف' name='submitDelete'\n </form> \n </td>\n ";
$grid .= '</tr>';
}
$colspan = count($fields) + 1;
$allRecordCount = mysql_num_rows($result);
$grid .= "<tr><td colspan='{$colspan}'>تعداد کل ردیف ها : {$allRecordCount}</td></tr>";
$grid .= '</table>';
echo $grid;
}
示例2: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
global $arrConf;
//folder path for custom templates
$local_templates_dir = getWebDirModule($module_name);
//conexion resource
$dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
$pDB = new paloDB($dsn);
//user credentials
global $arrCredentials;
$action = getAction();
$content = "";
switch ($action) {
case 'delete':
$content = deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
case 'download':
$content = downloadFile($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
case "display_record":
$content = display_record($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
default:
$content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
break;
}
return $content;
}
示例3: foreach
<?php
$root = '../';
require_once $root . 'logincheck.php';
require_once $root . 'functions.php';
$emp_section;
// Delete algo for multi-selection deletion.
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
foreach ($_POST as $key => $value) {
if (strpos($key, 'emp_section_') !== false && $value == 'on') {
$emp_section = deleteRecord('emp_section', 'emp_section_id', substr($key, 12));
}
}
// Change the message to confirm multiple deletion.
if (count($_POST) > 2 && $emp_section) {
$emp_section['message'] = 'Successfuly deleted all selected employee sections.';
}
// Create a message for the deleted emp_section.
$_SESSION['message'] = str_replace('Emp Section', 'Employee Section', $emp_section['message']);
}
// Reload the page
header("Location: ./");
exit;
示例4: modalidadeDelete
function modalidadeDelete($id)
{
deleteRecord('modalidades', "id_modalidade = " . dbInteger($id));
}
示例5: deleteRecord
function deleteRecord($id, $needDeleteFile = true)
{
$id = intval($id);
$res = mysql_query("SELECT rec_AddedByUGrpID, rec_OwnerUGrpID, rec_RecTypeID FROM Records WHERE rec_ID = " . $id);
$row = mysql_fetch_assoc($res);
$recTypeID = $row["rec_RecTypeID"];
$owner = $row["rec_OwnerUGrpID"];
if (!is_admin()) {
if (!($owner == get_user_id() || is_admin('group', $owner))) {
return array("error" => "user not authorised to delete record");
}
}
// find any references to the record
if (false) {
$res = mysql_query("SELECT DISTINCT dtl_RecID\n\t\t FROM defDetailTypes\n\t\t LEFT JOIN recDetails ON dtl_DetailTypeID = dty_ID\n\t\t WHERE dty_Type = 'resource'\n\t\t AND dtl_Value = " . $id);
$reference_count = mysql_num_rows($res);
if ($reference_count > 0) {
return array("error" => "record cannot be deleted - there are existing references to it");
}
}
$bkmk_count = 0;
$rels_count = 0;
$error = null;
// find any bookmarks of the record
/* AO: what we should do with $bkmk_ids?????
$reference_ids = array();
while ($row = mysql_fetch_assoc($res)) array_push($reference_ids, $row["dtl_RecID"]);
$res = mysql_query("select bkm_ID from Records left join usrBookmarks on bkm_recID=rec_ID where rec_ID = " . $id . " and bkm_ID is not null");
$bkmk_count = mysql_num_rows($res);
$bkmk_ids = array();
while ($row = mysql_fetch_assoc($res)) {
array_push($bkmk_ids, $row["bkm_ID"]);
}
$res = mysql_query('select '.USERS_USERNAME_FIELD.' from Records left join usrBookmarks on bkm_recID=rec_ID left join '.USERS_DATABASE.'.'.USERS_TABLE.' on '.USERS_ID_FIELD.'=bkm_UGrpID where rec_ID = ' . $rec_id);
$bkmk_count = mysql_num_rows($res);
$bkmk_users = array();
while ($row = mysql_fetch_assoc($res)) array_push($bkmk_users, $row[USERS_USERNAME_FIELD]);
($bkmk_count == 0 ||
($bkmk_count == 1 && $bkmk_users[0] == get_user_username())))) {
*/
while (true) {
//delete uploaded files
$fd_res = unregister_for_recid2($id, $needDeleteFile);
if ($fd_res) {
$error = "database error - " . $fd_res;
break;
}
mysql_query('SET foreign_key_checks = 0');
//
mysql_query('delete from recDetails where dtl_RecID = ' . $id);
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
//
mysql_query('delete from Records where rec_ID = ' . $id);
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
$deleted = mysql_affected_rows();
deleteRecordIndexEntry(DATABASE, $recTypeID, $id);
mysql_query('delete from usrReminders where rem_RecID = ' . $id);
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
mysql_query('delete from usrRecTagLinks where rtl_RecID = ' . $id);
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
mysql_query('delete from recThreadedComments where cmt_RecID = ' . $id);
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
//change all woots with title bookmark: to user:
mysql_query('update woots set woot_Title="user:" where woot_Title in (select concat("boomark:",bkm_ID) as title from usrBookmarks where bkm_recID = ' . $id . ')');
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
mysql_query('delete from usrBookmarks where bkm_recID = ' . $id);
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
$bkmk_count = mysql_affected_rows();
//delete from woot
mysql_query('delete from woot_ChunkPermissions where wprm_ChunkID in ' . '(SELECT chunk_ID FROM woots, woot_Chunks where chunk_WootID=woot_ID and woot_Title="record:' . $id . '")');
if (mysql_error()) {
$error = "database error - " . mysql_error();
break;
}
mysql_query('delete from woot_Chunks where chunk_WootID in ' . '(SELECT woot_ID FROM woots where woot_Title="record:' . $id . '")');
if (mysql_error()) {
//.........这里部分代码省略.........
示例6: unset
// Lifetime added 5min.
if (isset($_SESSION['EXPIRETIME'])) {
if ($_SESSION['EXPIRETIME'] < time()) {
unset($_SESSION['EXPIRETIME']);
header('Location: logout.php?TIMEOUT');
exit(0);
} else {
// Session time out time 5min.
//$_SESSION['EXPIRETIME'] = time() + 300;
$_SESSION['EXPIRETIME'] = time() + $sessionTimeout;
}
}
// Remove record.
if ($_GET['delUserId']) {
$delUserId = $_GET['delUserId'];
deleteRecord($delUserId);
}
// Select departments lists.
mysql_select_db($dbName) or die("Unable to select database: " . mysql_error());
$queryDept = "SELECT * from departments WHERE status = 'Active' ORDER BY deptName ASC";
$resultDept = mysql_query($queryDept);
$rowDept = mysql_num_rows($resultDept);
if (!$resultDept) {
die("Table access failed: " . mysql_error());
}
// Select position.
$queryPosition = "SELECT * FROM position WHERE status = 'Active' ORDER BY positionName ASC";
$resultPosition = mysql_query($queryPosition);
$rowPosition = mysql_num_rows($resultPosition);
if (!$resultPosition) {
die("Table access failed: " . mysql_error());
示例7: mysql_escape_string
$partsId = mysql_escape_string($_GET['partsId']);
// Lifetime added 5min.
if (isset($_SESSION['EXPIRETIME'])) {
if ($_SESSION['EXPIRETIME'] < time()) {
unset($_SESSION['EXPIRETIME']);
header('Location: logout.php?TIMEOUT');
exit(0);
} else {
// Session time out.
$_SESSION['EXPIRETIME'] = time() + $sessionTimeout;
}
}
// Remove record.
if ($_GET['delPartsId']) {
$delPartsId = $_GET['delPartsId'];
deleteRecord($delPartsId);
}
// Select parts details.
mysql_select_db($dbName) or die("Unable to select database: " . mysql_error());
$query = "SELECT * from partsMasterFile WHERE partsId = '{$partsId}' ORDER BY id DESC";
$result = mysql_query($query);
$row = mysql_num_rows($result);
if (!$result) {
die("Table access failed: " . mysql_error());
}
$data = mysql_fetch_assoc($result);
$dateTimeFull = $data['dateTime'];
if (preg_match('/(\\d{4}-\\d{2}-\\d{2})/', $dateTimeFull, $match)) {
$dateTime = $match[1];
}
$partsNumber = $data['partsNumber'];
示例8: connectDatabase
}
echo "{";
if ($_GET["action"] == "update") {
connectDatabase("usagedata");
getData();
echo ", ";
getMeta();
} else {
if ($_GET["action"] == "headers") {
connectDatabase("usagedata");
getHeaders();
} else {
if ($_GET["action"] == "locations") {
connectDatabase("usagedata");
getLocations();
} else {
if ($_GET["action"] == "delete") {
connectDatabase("usagedata");
deleteRecord();
} else {
connectDatabase("usagedata");
getHeaders();
echo ", ";
getData();
echo ", ";
getMeta();
}
}
}
}
echo "}";
示例9: visitanteDelete
function visitanteDelete($id)
{
deleteRecord("visitantes", "id_visitante = " . dbInteger($id));
}
示例10: DeleteJSONRecord
function DeleteJSONRecord($table)
{
if (!sesWriteAccess()) {
header('HTTP/1.1 403 Forbidden');
exit;
}
$id = getRequest('id', '');
if ($id) {
deleteRecord("{prefix}{$table}", $id);
header('Content-Type: application/json');
echo json_encode(['status' => 'ok']);
}
}
示例11: date
<tr>
<td></td>
<td>
<INPUT type="submit" name="button" value="Enter" style="padding:4px" /></td>
</tr>
</table>
</form>
</legend></fieldset>
<?php
$today = date('Y-m-d');
if ($_GET['submitted']) {
$genericInsert = "INSERT INTO deposit(trans_id,source,amount,discription,date,entryDate) " . "VALUES('','{$_POST['type']}','{$_POST['amount']}','{$_POST['description']}','{$_POST['date']}','{$today}');";
$depositResult = mysql_query($genericInsert);
if ($depositResult != null) {
echo '<p>Data entered successfully</p>';
} else {
echo '<p>Failed to enter data</p>';
}
displayToday('deposit');
}
if ($_GET['func'] == 'delete') {
$id = $_GET['ref'];
$deleted = deleteRecord($id, 'deposit');
if ($deleted) {
echo '<p>Item deleted successfully.</p>';
}
displayToday('deposit');
}
示例12: foreach
echo "document.getElementById('percent').innerHTML = Math.round(1000 * processed / " . $total_cnt . " ) / 10;";
?>
}
</script>
<?php
print '<div><span id=total_count>' . $total_cnt . '</span> records in total to be deleted</div>';
print '<div><span id=processed_count>0</span> processed so far <span id=percent>0</span>%</div>';
print '<div><span id=deleted>0</span> deleted</div>';
print '<div><span id=relations>0</span> relationships</div>';
print '<div><span id=bookmarks>0</span> associated bookmarks</div>';
print '<div><span id=errors>0</span> errors</div>';
$needDeleteFile = @$_REQUEST['delfile'] == "1";
if ($total_cnt > 0) {
foreach ($_REQUEST['bib'] as $rec_id) {
mysql_query("start transaction");
$res = deleteRecord($rec_id, $needDeleteFile);
//$res = array("bkmk_count"=>0, "rel_count"=>0);
if (array_key_exists("error", $res)) {
mysql_query("rollback");
array_push($errors, "Rec#" . $rec_id . " " . $res["error"]);
} else {
mysql_query("commit");
$recs_count++;
$bkmk_count += $res["bkmk_count"];
$rels_count += $res["rel_count"];
}
$processed_count++;
if ($rec_id % 10 == 0) {
print '<script type="text/javascript">update_counts(' . $processed_count . ',' . $recs_count . ',' . $rels_count . ',' . $bkmk_count . ',' . count($errors) . ')</script>' . "\n";
@ob_flush();
@flush();
示例13: deleteRecType
/**
* deleteRectype - Helper function that delete a rectype from defRecTypes table.if there are no existing records of this type
*
* @author Stephen White
* @param $rtyID rectype ID to delete
* @return $ret an array of return values for the various data elements created or errors if they occurred
**/
function deleteRecType($rtyID)
{
global $mysqli;
$ret = array();
$query = "select rec_ID from Records where rec_RecTypeID={$rtyID} and rec_FlagTemporary=0 limit 1";
$res = $mysqli->query($query);
$error = $mysqli->error;
if ($error) {
$ret['error'] = "SQL error finding records of type {$rtyID} in the Records table: " . $error;
} else {
$recCount = $res->num_rows;
if ($recCount) {
// there are records existing of this rectype, need to return error and the recIDs
$ret['error'] = "You cannot delete record type {$rtyID} as it has existing data records";
//$recCount
$ret['recIDs'] = array();
while ($row = $res->fetch_row()) {
array_push($ret['recIDs'], $row[0]);
}
} else {
// no records ok to delete this rectype. Not that this should cascade for all dependent definitions
//delete temporary records
$query = "select rec_ID from Records where rec_RecTypeID={$rtyID} and rec_FlagTemporary=1";
$res = $mysqli->query($query);
while ($row = $res->fetch_row()) {
deleteRecord($row[0]);
}
$query = "delete from defRecTypes where rty_ID = {$rtyID}";
$res = $mysqli->query($query);
if ($mysqli->error) {
$ret['error'] = "SQL error deleting record type {$rtyID} from defRecTypes table: " . $mysqli->error;
} else {
$icon_filename = HEURIST_ICON_DIR . $rtyID . ".png";
//BUG what about thumb??
if (file_exists($icon_filename)) {
unlink($icon_filename);
}
$ret['result'] = $rtyID;
}
}
}
return $ret;
}
示例14: show404
show404();
}
$crud_page = getCrudPage($_GET['page_id']);
if (!$crud_page) {
show404();
}
pr($crud_page);
// default values
$recordTitle = singularize($crud_page['title'], 0, -1);
// e.g. Employee, Pay Record etc
$url = $crud_page['url'] . "?page_id=" . $_GET['page_id'];
// $url = isset( $_SERVER['HTTP_REFERER'] )? $_SERVER['HTTP_REFERER'] : $crud_page['url']."?page_id=".$crud_page['id'];
// check deleting:
if (isset($_GET['record_id']) && isset($_GET['delete']) && $_GET['delete'] == 'true') {
$logmsg = $recordTitle . " Deleted: Record Id = " . $_GET['record_id'];
deleteRecord($crud_page['table_name'], "id=" . $_GET['record_id'], $logmsg, $url);
}
// handle posted data
if (isset($_POST['submit'])) {
// prpost();
validatefft($crud_page['table_name']);
if ($form->isValid()) {
$condition = isset($_GET['record_id']) ? "id=" . $_GET['record_id'] : NULL;
$logmsg = isset($_GET['record_id']) ? $recordTitle . " Edited: " . $recordTitle . " ID: " . $_POST['id'] : "New " . $recordTitle . " Saved";
saveFormData($crud_page['table_name'], $_POST, $condition, $logmsg, $url);
}
}
?>
<h2><?php
echo $recordTitle;
示例15: header
header('Location: logout.php?TIMEOUT');
exit(0);
} else {
/**
Session time out time 5min.
**/
//$_SESSION['EXPIRETIME'] = time() + 300;
$_SESSION['EXPIRETIME'] = time() + $sessionTimeout;
}
}
/**
Remove record.
**/
if ($_GET['delStatusId']) {
$delStatusId = $_GET['delStatusId'];
deleteRecord($delStatusId);
}
/**
Select status lists.
**/
mysql_select_db($dbName) or die("Unable to select database: " . mysql_error());
$query = "SELECT * FROM status WHERE statusId = '{$statusId}'";
$result = mysql_query($query);
if (!$result) {
die("Table access failed: " . mysql_error());
}
$data = mysql_fetch_array($result);
$statusName = $data['statusName'];
if (isset($_POST['statusId']) && isset($_POST['statusName'])) {
$statusId = $_POST['statusId'];
$statusName = ucwords(mysql_escape_string($_POST['statusName']));