本文整理汇总了PHP中process_sql_update函数的典型用法代码示例。如果您正苦于以下问题:PHP process_sql_update函数的具体用法?PHP process_sql_update怎么用?PHP process_sql_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_sql_update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_task_completion
/**
* Calculate task completion porcentage and set on task
*
* @param int Id of the task to calculate.
*/
function set_task_completion($id_task)
{
$hours_worked = get_task_workunit_hours($id_task);
$hours_estimated = get_db_value('hours', 'ttask', 'id', $id_task);
if ($hours_estimated == 0) {
return 0;
}
$percentage_completed = $hours_worked * 100 / $hours_estimated;
process_sql_update('ttask', array('completion' => $percentage_completed), array('id' => $id_task));
return $percentage_completed;
}
示例2: mysql_session_write
function mysql_session_write($SessionID, $val)
{
$SessionID = addslashes($SessionID);
$val = addslashes($val);
$sql = "SELECT COUNT(*) FROM tsessions_php\n\t\tWHERE id_session = '{$SessionID}'";
$SessionExists = process_sql($sql);
$session_exists = $SessionExists[0]['COUNT(*)'];
if ($session_exists == 0) {
$now = time();
$retval_write = process_sql_insert('tsessions_php', array('id_session' => $SessionID, 'last_active' => $now, 'data' => $val));
} else {
$now = time();
$retval_write = process_sql_update('tsessions_php', array('last_active' => $now, 'data' => $val), array('id_session' => $SessionID));
}
return $retval_write;
}
示例3: get_parameter
$id = 0;
}
// UPDATE
if ($update) {
$id = get_parameter("id", 1);
$email_subject = get_parameter("email_subject");
$status = get_parameter("status");
$html = get_parameter("html");
$plain = get_parameter("plain");
$date = get_parameter("issue_date");
$time = get_parameter("issue_time");
$id_newsletter = get_parameter("id_newsletter");
$campaign = get_parameter("campaign");
$from_address = get_parameter("from_address");
$values = array('id_newsletter' => $id_newsletter, 'email_subject' => $email_subject, 'html' => $html, 'plain' => $plain, 'status' => $status, 'datetime' => $date . " " . $time, 'id_campaign' => $campaign, 'from_address' => $from_address);
$result = process_sql_update('tnewsletter_content', $values, array('id' => $id));
if ($result === false) {
echo "<h3 class='error'>" . __('Could not be updated') . "</h3>";
} else {
echo "<h3 class='suc'>" . __('Successfully updated') . "</h3>";
audit_db($config["id_user"], $config["REMOTE_ADDR"], "NEWSLETTER UPDATED", "Updated newsletter issue {$email_subject}");
}
$id = 0;
}
// DELETE
if ($delete) {
// if delete
$id = (int) get_parameter('id');
$id_newsletter = get_db_value("id_newsletter", "tnewsletter_content", "id", $id);
$name = get_db_value('name', 'tnewsletter', 'id', $id_newsletter);
$sql = sprintf('DELETE FROM tnewsletter_content WHERE id = %d', $id);
示例4: __
echo "<h3 class='error'>" . __('There was a problem deleting row') . "</h3>";
}
}
if ($update_row) {
$key = get_parameter('key');
$key_value = get_parameter('key_value');
$fields = get_db_all_rows_sql("DESC " . $external_table);
if ($fields == false) {
$fields = array();
}
foreach ($fields as $field) {
if ($field['Field'] != $key) {
$values[$field['Field']] = get_parameter($field['Field']);
}
}
$result = process_sql_update($external_table, $values, array($key => $key_value));
if ($result) {
echo "<h3 class='suc'>" . __('Updated row') . "</h3>";
} else {
echo "<h3 class='error'>" . __('There was a problem updating row') . "</h3>";
}
}
if ($insert_row) {
$fields = get_db_all_rows_sql("DESC " . $external_table);
$key = get_parameter('key');
if ($fields == false) {
$fields = array();
}
foreach ($fields as $field) {
if ($field['Field'] != $key) {
$values[$field['Field']] = get_parameter($field['Field']);
示例5: get_parameter
$id = (int) get_parameter('id');
$create = (bool) get_parameter('create');
$update = (bool) get_parameter('update');
$delete = (bool) get_parameter('delete');
$validate_newsletter = (bool) get_parameter('validate_newsletter', 0);
if ($validate_newsletter) {
$sql = "SELECT * FROM tnewsletter_address WHERE id_newsletter = {$id} AND validated = 0";
$newsletter_emails = get_db_all_rows_sql($sql);
if ($newsletter_emails === false) {
$newsletter_emails = array();
}
$i = 0;
foreach ($newsletter_emails as $email) {
$values['validated'] = 1;
$values['status'] = 0;
process_sql_update('tnewsletter_address', $values, array('id' => $email['id']));
$i++;
}
echo "<h3 class='suc'>" . __('Emails validated: ') . $i . "</h3>";
$id = 0;
}
// CREATE
if ($create) {
if (!$manager) {
audit_db($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation", "Trying to create a new newsletter");
require "general/noaccess.php";
exit;
}
$name = get_parameter("name");
$id_group = get_parameter("id_group", 1);
$from_desc = get_parameter("from_desc");
示例6: json_encode
$result["message"] = $upload_result;
}
echo json_encode($result);
return;
}
$update_file_description = (bool) get_parameter("update_file_description");
if ($update_file_description) {
$id_file = (int) get_parameter("id_attachment");
$file_description = get_parameter("file_description");
$result = array();
$result["status"] = false;
$result["message"] = "";
$result['status'] = (bool) process_sql_update('tattachment',
array('description' => $file_description), array('id_attachment' => $id_file));
if (!$result['status'])
$result['message'] = __('Description not updated');
echo json_encode($result);
return;
}
$get_file_row = (bool) get_parameter("get_file_row");
if ($get_file_row) {
$id_file = (int) get_parameter("id_attachment");
$file = get_incident_file($id, $id_file);
$html = "";
if ($file) {
示例7: update_tag
/**
* Delete a tag.
*
* @param int Id of the tag.
* @param array Values of the tag.
*
* @return mixed The number of the items updated (int) of false (bool) on error.
*/
function update_tag($id, $values)
{
if (empty($id) || !is_numeric($id)) {
throw new InvalidArgumentException(__('ID should be numeric'));
}
if ($id <= 0) {
throw new RangeException(__('ID should be a number greater than 0'));
}
if (isset($values[TAGS_TABLE_NAME_COL]) && empty($values[TAGS_TABLE_NAME_COL])) {
throw new InvalidArgumentException(__('The name cannot be empty'));
}
if (isset($values[TAGS_TABLE_NAME_COL]) && strlen($values[TAGS_TABLE_NAME_COL]) > 255) {
throw new InvalidArgumentException(__('The name is too big'));
}
$where = array(TAGS_TABLE_ID_COL => $id);
$result = process_sql_update(TAGS_TABLE, $values, $where);
return $result;
}
示例8: json_encode
$values['invoice_expiration_date'] = $invoice_expiration_date;
$values['invoice_type'] = $invoice_type;
$values['id_language'] = $language;
$values['internal_note'] = $internal_note;
$values['bill_id_variable'] = $bill_id_variable;
$values['bill_id_pattern'] = $bill_id_pattern;
$values['contract_number'] = $invoice_contract_number;
$values['tax_name'] = json_encode($tax_name_array);
$values['discount_before'] = $discount_before;
$values['discount_concept'] = $discount_concept;
$where = array('id' => $id_invoice);
$ret = process_sql_update ('tinvoice', $values, $where);
if ($create_calendar_event) {
$now = date('Y-m-d H:i:s');
$time = substr($now, 11, 18);
$title = __('Reminder: Invoice ').$bill_id.__(' payment date');
$sql_event2 ="DELETE FROM tagenda WHERE title='".$title."';";
process_sql ($sql_event2);
$sql_event ="INSERT INTO tagenda (public, alarm, timestamp, id_user,
title, duration, description)
VALUES (0, '1440', '$invoice_payment_date $time', '".$config['id_user']."', '$title',
0, '')";
示例9: get_parameter
if ($update_field) {
//update field to incident type
$id_field = get_parameter('id_field');
$value_update['label'] = get_parameter('label');
$value_update['type'] = get_parameter('type');
$value_update['combo_value'] = get_parameter('combo_value', '');
$error_update = false;
if ($value_update['type'] == "combo") {
if ($value_update['combo_value'] == '') {
$error_update = true;
}
}
if ($error_update) {
echo ui_print_error_message(__('Field could not be updated. Empty combo value'), '', true, 'h3', true);
} else {
$result_update = process_sql_update('tuser_field', $value_update, array('id' => $id_field));
if ($result_update === false) {
echo ui_print_error_message(__('Field could not be updated'), '', true, 'h3', true);
} else {
echo ui_print_success_message(__('Field updated successfully'), '', true, 'h3', true);
}
}
}
echo "<h2>" . __("User fields") . "</h2>";
echo "<h4>" . __("List fields") . "</h4>";
$user_fields = get_db_all_rows_sql("SELECT * FROM tuser_field");
if ($user_fields === false) {
$user_fields = array();
}
$table = new StdClass();
$table->width = '100%';
示例10: update_user_password
/**
* Update the password in MD5 for user pass as id_user with
* password in plain text.
*
* @param string user User ID
* @param string password Password in plain text.
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function update_user_password($user, $password_new)
{
return process_sql_update('tusuario', array('password' => md5($password_new)), array('id_usuario' => $user));
}
示例11: array
}
}
}
// Close
if ($close) {
if (!$write_permission && !$manage_permission) {
audit_db ($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation", "Trying to close a lead");
require ("general/noaccess.php");
exit;
}
$values = array('progress' => 100);
$where = array('id' => $id);
$result = process_sql_update('tlead', $values, $where);
if ($result > 0) {
$values = array(
'id_lead' => $id,
'id_user' => $config["id_user"],
'timestamp' => date ("Y-m-d H:i:s"),
'description' => "Lead closed"
);
process_sql_insert('tlead_history', $values);
echo ui_print_success_message (__('Successfully closed'), '', true, 'h3', true);
$id = 0;
if ($massive_leads_update && is_ajax()) {
$total_result['closed'] = true;
示例12: um_db_update_auth
function um_db_update_auth($id_auth, $client_key, $subscription_limit, $description = '', $developer = false)
{
if (!is_numeric($subscription_limit)) {
echo '<strong>Error</strong>: Subscription must be numeric<br />';
return false;
}
$values = array('client_key' => $client_key, 'subscription_limit' => $subscription_limit, 'description' => $description, 'developer' => $developer);
$where = array('id' => $id_auth);
$result = process_sql_update(DB_PREFIX . 'tupdate_auth', $values, $where);
if ($result === false) {
echo '<strong>Error updating authorization</strong><br />';
return false;
}
return true;
}
示例13: quickIncidentUpdate
public function quickIncidentUpdate($id_incident, $type, $value)
{
$system = System::getInstance();
$column = "";
switch ($type) {
case 'priority':
$column = "prioridad";
break;
case 'owner':
$column = "id_usuario";
break;
case 'resolution':
$column = "resolution";
break;
case 'status':
$column = "estado";
break;
}
if ($column) {
$res = process_sql_update('tincidencia', array($column => $value), array("id_incidencia" => $id_incident));
if ($res && (include_once $system->getConfig('homedir') . "/include/functions_incidents.php")) {
switch ($type) {
case 'priority':
incident_tracking($id_incident, INCIDENT_PRIORITY_CHANGED, $value);
break;
case 'owner':
incident_tracking($id_incident, INCIDENT_USER_CHANGED, $value);
break;
case 'resolution':
incident_tracking($id_incident, INCIDENT_RESOLUTION_CHANGED, $value);
break;
case 'status':
incident_tracking($id_incident, INCIDENT_STATUS_CHANGED, $value);
break;
}
}
}
return $res;
}
示例14: update_config_token
update_config_token("invoice_tax_name", $config["invoice_tax_name"]);
update_config_token("lead_warning_time", $config["lead_warning_time"]);
update_config_token("invoice_auto_id", $config["invoice_auto_id"]);
update_config_token("invoice_id_pattern", $config["invoice_id_pattern"]);
//Update lead progress names
$progress["0"] = get_parameter("progress_0");
$progress["20"] = get_parameter("progress_20");
$progress["40"] = get_parameter("progress_40");
$progress["60"] = get_parameter("progress_60");
$progress["80"] = get_parameter("progress_80");
$progress["100"] = get_parameter("progress_100");
$progress["101"] = get_parameter("progress_101");
$progress["102"] = get_parameter("progress_102");
$progress["200"] = get_parameter("progress_200");
foreach ($progress as $key => $value) {
process_sql_update('tlead_progress', array('name' => $value), array('id' => $key));
}
}
$table->width = '99%';
$table->class = 'search-table-button';
$table->colspan = array();
$table->data = array();
// Gets all .png, .jpg and .gif files from "images" directory
// and returns an array with their names
function get_logo_files()
{
$base_dir = 'images/custom_logos';
$files = list_files($base_dir, ".png", 1, 0);
$files = array_merge($files, list_files($base_dir, ".jpg", 1, 0));
$files = array_merge($files, list_files($base_dir, ".gif", 1, 0));
$retval = array();
示例15: count
/* Auto fill values */
$len = count($data);
if ($len < $nfields) {
$data = array_pad($data, $nfields, '');
} elseif ($len > $nfields) {
$data = array_slice($data, NULL, $nfields);
}
$values = array_combine($fields, $data);
if (empty($values['name'])) {
continue;
}
/* Check parent */
if (is_int($values['id_parent'])) {
$id_parent = (int) get_db_value('id', 'tinventory', 'id', $values['id_parent']);
} else {
$id_parent = (int) get_db_value('id', 'tinventory', 'name', (string) $values['id_parent']);
}
$values['id_parent'] = $id_parent ? $id_parent : NULL;
/* Check if the inventory item already exists */
$id_inventory = (int) get_db_value_filter('id', 'tinventory', array('name' => $values['name'], 'id_parent' => $values['id_parent']));
process_values($values, $id_inventory);
if ($id_inventory) {
process_sql_update('tinventory', $values, array('id' => $id_inventory));
echo 'Updated inventory "' . $values['name'] . '"';
} else {
process_sql_insert('tinventory', $values);
echo 'Inserted inventory "' . $values['name'] . '"';
}
echo "\n";
}
fclose($file);