本文整理汇总了PHP中updateDB函数的典型用法代码示例。如果您正苦于以下问题:PHP updateDB函数的具体用法?PHP updateDB怎么用?PHP updateDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updateDB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadImg
function uploadImg()
{
echo "<pre>";
print_r($_FILES);
print_r($_REQUEST['name']);
echo "</pre>";
$unlink_file = $_REQUEST['name'];
$img_name = str_replace(".jpg", ".png", $unlink_file);
//Borra la imagen original..
if (unlink($unlink_file)) {
echo "Imagen original eliminada correctamente..";
//Sube al servidor la imagen modificada..
if (move_uploaded_file($_FILES['file']['tmp_name'], "./" . $img_name)) {
//Actualiza DB..
if (updateDB($img_name)) {
echo "DB modifiada con exito..";
} else {
echo "No se pudo actualizar la DB..";
}
} else {
echo "Fallo la subida..";
}
} else {
echo "No se pudo borrar la imagen original..";
}
/*
define('UPLOAD_DIR', 'img/');
$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
*/
}
示例2: save
function save($action)
{
global $dbn, $action;
#return 'action = ' . $action;
if (isset($_POST['memberSelect'])) {
$id = $_POST['memberSelect'];
} else {
if (!isset($_POST['uname']) or !isset($_POST['pword']) or !isset($_POST['pwordConfirm'])) {
return 'You left something out!';
}
$id = $_POST['id'];
$uname = $_POST['uname'];
$pword1 = $_POST['pword'];
$pword2 = $_POST['pwordConfirm'];
$pword = md5($pword1);
if ($action != 'Delete' and $pword1 != $pword2) {
return 'The passwords don\'t match!';
}
}
switch ($action) {
case 'Add':
$ip = $_SERVER['REMOTE_HOST'];
$sql = "insert into myprogramo (id, uname, pword, lastip, lastlogin) values (null, '{$uname}', '{$pword}','{$ip}', CURRENT_TIMESTAMP);";
$out = "Account for {$uname} successfully added!";
break;
case 'Delete':
$action = 'Add';
$sql = "DELETE FROM `{$dbn}`.`myprogramo` WHERE `myprogramo`.`id` = {$id} LIMIT 1";
$out = "Account for {$uname} successfully deleted!";
break;
case 'Edit':
$action = 'Add';
$sql = "update myprogramo set uname = '{$uname}', pword = '{$pword}' where id = {$id};";
$out = "Account for {$uname} successfully updated!";
break;
default:
$action = 'Edit';
$sql = '';
$out = '';
}
$x = !empty($sql) ? updateDB($sql) : '';
#return "action = $action<br />\n SQL = $sql";
return $out;
}
示例3: SQLite3
// какие валюты запрошены
$currencyBase = $_REQUEST['b'];
// какая - базовая
$dtTo = $_REQUEST['to'];
// только конец диапазона, потому что вынимаем всегда на год назад
// если базовая не рубль, мы её принудительно включим в перечень запрошенных, если её там нет, чтобы данные по ней вытащить из источника и/или базы
if ($currencyBase != 'RUB') {
if (array_search($currencyBase, $currencies) === false) {
$currencies[] = $currencyBase;
}
}
// инициализация базы
$db = new SQLite3('rates.db');
initDB($db);
// обновляем базу по запрошенному перечню и дате конца периода
updateDB($db, $currencies, $dtTo);
// готовим ответ, обращаясь уже к базе
// здесь будем вынимать данные, заполнять пустые даты, приводить курсы к базовой валюте, пересчитывая по рублю
$res['data'] = prepareResponse($db, $currencies, $currencyBase, $dtTo);
// отправляем приложению
header('Access-Control-Allow-Origin: *');
header('Content-type: application/json');
echo json_encode($res);
// ------------------------------------------------
// готовим данные
function prepareResponse($db, $currencies, $currencyBase, $dtTo)
{
$res = array();
// для каждой валюты в запросе
foreach ($currencies as $currency) {
if ($currency == 'RUB') {
示例4: step07_dealSQL
function step07_dealSQL()
{
// $this->closeSite();
$filePath = $targetDir = DATA_PATH . '/update/download/unzip/updateDB.php';
if (!file_exists($filePath)) {
// 如果本次升级没有数据库的更新,直接返回
echo 1;
exit;
}
require_once $filePath;
updateDB();
unlink($filePath);
// 数据库验证
$filePath = $targetDir = DATA_PATH . '/update/download/unzip/checkDB.php';
if (!file_exists($filePath)) {
// 如果本次升级没有数据库的更新后的验证代码,直接返回
echo 1;
exit;
}
require_once $filePath;
// checkDB方法正常返回1 否则返回异常的说明信息,如:ts_xxx数据表创建不成功
checkDB();
unlink($filePath);
echo 1;
}
示例5: mysql_get_rows
$is_exists = mysql_get_rows('user_completed_couse', array('where' => "section_id='{$section_id}' AND user_id='{$user_id}'"), 1);
if ($is_exists === '') {
$section_data = mysql_get_rows('course_sections', array('where' => "id='{$section_id}'"), 1);
$insert_values = array('user_id' => $user_id, 'course_id' => $section_data['course_id'], 'section_id' => $section_id);
$id = insertDB($insert_values, 'user_completed_couse');
$completed = array();
} else {
$id = $is_exists['id'];
if (trim($is_exists['completed']) === '') {
$completed = array();
} else {
$completed = explode(',', trim($is_exists['completed']));
}
}
if ($enable == 1) {
$completed[] = $step_id;
array_unique($completed);
$str_completed = implode(',', $completed);
updateDB("completed = '{$str_completed}'", "WHERE id='{$id}'", 'user_completed_couse');
$return_data['status'] = 1;
$return_data['enable'] = 1;
} else {
$completed = array_diff($completed, array($step_id));
array_unique($completed);
$str_completed = implode(',', $completed);
updateDB("completed = '{$str_completed}'", "WHERE id='{$id}'", 'user_completed_couse');
$return_data['status'] = 1;
$return_data['enable'] = 0;
}
echo json_encode($return_data);
exit;
示例6: elseif
if ($name == 'email') {
$email = $value;
// XXX do stripslashes() here and below?
} elseif ($name == 'rationale') {
$rationale = $value;
} elseif ($value == 'TBW' || $value == 'WIP' || $value == 'SCS' || $value == 'none') {
// Ignore any other values, including empty values.
$status[addslashes($name)] = $value;
}
}
// Ensure that email and rationale were provided
if ($email == '' || !Email::isValidEmail($email) || $rationale == '' || !isUTF8($rationale) || mb_strlen($rationale) > 125) {
getMissingInfo($email, $rationale, $status);
} else {
if ($_SERVER['PATH_INFO'] == '/confirm') {
updateDB($email, $rationale, $status);
outputConfirmed();
} else {
$body = getMailConfirmRequest($email, $rationale, $status);
$sig = "HTML5 Status Updates\nhttp://www.whatwg.org/html5";
$mail = new Email();
$mail->setSubject("HTML5 Status Update");
$mail->addRecipient('To', 'whatwg@lachy.id.au', 'Lachlan Hunt');
$mail->setFrom("whatwg@whatwg.org", "WHATWG");
$mail->setSignature($sig);
$mail->setText($body);
$mail->send();
outputConfirmation($body, $sig);
}
}
function getMissingInfo($email, $rationale, $status)
示例7: array
}
if (!empty($_POST['lastname'])) {
$lastname_edit = $_POST['lastname'];
$input_cols[] = "lastname";
$input_adds[] = $lastname_edit;
$valid = true;
}
if (!empty($_POST['birthdate'])) {
$birthdate_edit = $_POST['birthdate'];
$input_cols[] = "birthdate";
$input_adds[] = $birthdate_edit;
$valid = true;
}
$edit_input = array($input_cols, $input_adds);
if ($valid) {
updateDB("users", $edit_input, array("id", $user_id));
}
}
?>
<form id='form_users_edit' action="" method="post">
<?php
echo "<table id='table_users' border cellpadding='5px'> \n <tr style='color:red; font-weight:bold; text-align:center; '>\n <td style='padding:10px;'>Username</td>\n <td style='padding:10px;''>Email</td>\n <td style='padding:10px;''>Password</td>\n <td style='padding:10px;''>First Name</td>\n <td style='padding:10px;''>Last Name</td>\n <td style='padding:10px;''>BirthDate</td>\n <td style='padding:10px;''>O</td>\n </tr>";
$sql = select("users", array("id", "username", "email", "password", "firstname", "lastname", "birthdate"));
echo 'Number of Affected Rows : ' . count(mysqli_fetch_array($sql));
while ($rows = mysqli_fetch_array($sql)) {
echo "<tr><td>" . $rows['username'] . "</td>";
echo "<td>" . $rows['email'] . "</td>";
echo "<td>" . $rows['password'] . "</td>";
echo "<td>" . $rows['firstname'] . "</td>";
echo "<td>" . $rows['lastname'] . "</td>";
示例8: ob_flush
$result->close();
$mysqli->commit();
echo "<li>Updating standard_setting values in the properties table</li>\n";
ob_flush();
flush();
// Call the standard_setting list page to populate the results in std_set table.
$result = $mysqli->prepare("SELECT DISTINCT property_id, total_mark FROM properties WHERE marking LIKE '2,%'");
$result->execute();
$result->store_result();
$result->bind_result($property_id, $total_mark);
while ($result->fetch()) {
$no_reviews = 0;
$reviews = get_reviews($mysqli, 'index', $property_id, $total_mark, $no_reviews);
foreach ($reviews as $review) {
if ($review['method'] != 'Hofstee') {
updateDB($review, $mysqli);
}
}
}
$result->close();
}
// 04/07/2013 (cczsa1) - enhanced question type config
$new_lines = array("\n// Enhanced Calculation question config\n", "\$enhancedcalculation = array('host' => 'localhost', 'port'=>6311,'timeout'=>5); //default enhancedcalc Rserve config options\n", "//but use phpEval as default for enhanced calculation questions\n", "\$enhancedcalc_type = 'phpEval'; //set the enhanced calculation to use php for maths \n", "\$enhancedcalculation = array(); //no config options for phpEval enhancedcalc plugin");
$target_line = '$cfg_password_expire';
$updater_utils->add_line($string, '$enhancedcalculation', $new_lines, 80, $cfg_web_root, $target_line, 1);
// 04/07/2013 (cczsa1) - add new field to logs to indicate an error state
if (!$updater_utils->does_column_exist('log0', 'errorstate')) {
$updater_utils->execute_query("ALTER TABLE log0 ADD COLUMN errorstate tinyint unsigned NOT NULL DEFAULT '0' AFTER user_answer", true);
}
if (!$updater_utils->does_column_exist('log0_deleted', 'errorstate')) {
$updater_utils->execute_query("ALTER TABLE log0_deleted ADD COLUMN errorstate tinyint unsigned NOT NULL DEFAULT '0' AFTER user_answer", true);
示例9: egive_egv
if ($doUpdate) {
$sSQL = "INSERT INTO egive_egv (egv_egiveID, egv_famID, egv_DateEntered, egv_EnteredBy) VALUES ('" . $egiveID . "','" . $famID . "','" . date("YmdHis") . "','" . $_SESSION['iUserID'] . "');";
RunQuery($sSQL);
}
foreach ($giftDataMissingEgiveID as $data) {
$fields = explode('|', $data);
if ($fields[2] == $egiveID) {
$transId = $fields[0];
$date = $fields[1];
$name = $fields[3];
$amount = $fields[4];
$fundId = $fields[5];
$comment = $fields[6];
$frequency = $fields[7];
$groupKey = $fields[8];
updateDB($famID, $transId, $date, $name, $amount, $fundId, $comment, $frequency, $groupKey);
}
}
} else {
++$importError;
}
}
$_SESSION['giftDataMissingEgiveID'] = $giftDataMissingEgiveID;
$_SESSION['egiveID2NameWithUnderscores'] = $egiveID2NameWithUnderscores;
importDoneFixOrContinue();
} else {
?>
<table cellpadding="3" align="left">
<tr><td>
<form method="post" action="eGive.php?DepositSlipID=<?php
echo $iDepositSlipID;
示例10: convert
function convert($fromFile, $toFile)
{
global $FFMPEG, $count, $REGISTERED_MEDIA_EXTENSION, $FROM_DIR, $con;
$cmd = $FFMPEG . " -v warning -i " . escapeshellarg($fromFile) . " -map 0 -sn -vcodec libx264 -acodec libfaac " . escapeshellarg($toFile) . " -y 2>&1";
//$cmd = $FFMPEG . " -v warning -i '" . $fromFile . "' -map 0 -sn -vcodec copy -acodec copy '" . $toFile . "' -y 2>&1";
//$cmd = "cp '" . $fromFile . "' '" . $toFile. "' 2>&1";
echo $cmd . "\n";
$exec_output = array();
$return_var = -1;
exec($cmd, $exec_output, $return_var);
$path = preg_split("|/|i", $fromFile);
if ($return_var == 0) {
//echo $fromFile . " - Ok\n";
$updDB = updateDB(str_replace($FROM_DIR, '', $fromFile), str_replace($FROM_DIR, '', $toFile));
if ($updDB) {
echo str_replace($FROM_DIR, '', $fromFile) . " updated\n";
exec("rm -f " . escapeshellarg($fromFile));
} else {
echo str_replace($FROM_DIR, '', $fromFile) . " NOT UPDATED !!!!!\n";
}
} else {
echo "\tError executing:\n";
for ($i = 0; $i < sizeof($exec_output); $i++) {
echo "\t" . $exec_output[$i] . "\n";
}
}
}
示例11: fclose
}
if (!fwrite($handle, $dump_buffer)) {
$keyMessage = 'ErrorWriteDump';
$error = 1;
} else {
$keyMessage = 'WriteDumpConfirm';
}
fclose($handle);
}
//end else
if ($error != 1) {
$_SESSION['hostDB_old'] = $_POST['dbHost_old'];
$_SESSION['nameDB_old'] = $_POST['dbName_old'];
$_SESSION['userDB_old'] = $_POST['dbAdminUsername_old'];
$_SESSION['passDB_old'] = $_POST['dbAdminPasswd_old'];
if (!updateDB($_POST['dbHost'], $_POST['dbAdminUsername'], $_POST['dbAdminPasswd'], $_POST['dbName'], $_POST['dbHost_old'], $_POST['dbAdminUsername_old'], $_POST['dbAdminPasswd_old'], $_POST['dbName_old'])) {
$keyMessage = 'ErrorUpdateDb';
} else {
$keyMessage = 'UpdateDb';
$enableUpdateImage = 1;
}
}
} else {
$error = 1;
$keyMessage = 'WrongDbName';
}
} else {
$error = 1;
$keyMessage = 'WrongDbCredit';
}
break;
示例12: insertDB
}
}
insertDB($insert_data[0], 'messages');
// Start order if not started
if ($job_type !== '') {
if ($job_type == 2 && $payment_data['order_started'] == 0) {
// TODO : change status 2 - Done
$order_date = date('Y-m-d H:i:s');
updateDB("order_started = 1, order_start_date = '{$order_date}', job_status = 2", "WHERE id = '{$payment_data['id']}'", 'payments');
$insert_data[1] = delivery_start_msg($payment_data['id'], $user_data['id']);
} elseif ($job_type == 4 && in_array($payment_data['job_status'], array(3))) {
updateDB("job_status = 4", "WHERE id = '{$payment_data['id']}'", 'payments');
} elseif ($job_type == 5 && in_array($payment_data['job_status'], array(3))) {
updateDB("job_status = 5", "WHERE id = '{$payment_data['id']}'", 'payments');
} elseif ($job_type == 6) {
updateDB("job_status = 6", "WHERE id = '{$payment_data['id']}'", 'payments');
}
}
$return_data['status'] = 1;
$return_data['message'] = 'Message sent successfully';
} else {
$messages = '';
foreach ($v->errors() as $k => $msgs) {
foreach ($msgs as $msg) {
$messages .= $msg . "<br>";
}
}
$return_data['message'] = $messages;
}
}
}
示例13: parseAIML
function parseAIML($fn, $aimlContent)
{
if (empty($aimlContent)) {
return "File {$fn} was empty!";
}
global $debugmode, $bot_id, $default_charset;
$fileName = basename($fn);
$success = false;
$dbconn = db_open();
#Clear the database of the old entries
$sql = "DELETE FROM `aiml` WHERE `filename` = '{$fileName}' AND bot_id = '{$bot_id}'";
if (isset($_POST['clearDB'])) {
$x = updateDB($sql);
}
$myBot_id = isset($_POST['bot_id']) ? $_POST['bot_id'] : $bot_id;
# Read new file into the XML parser
$sql_start = "insert into `aiml` (`id`, `bot_id`, `aiml`, `pattern`, `thatpattern`, `template`, `topic`, `filename`, `php_code`) values\n";
$sql = $sql_start;
$sql_template = "(NULL, {$myBot_id}, '[aiml_add]', '[pattern]', '[that]', '[template]', '[topic]', '{$fileName}', ''),\n";
# Validate the incoming document
/*******************************************************/
/* Set up for validation from a common DTD */
/* This will involve removing the XML and */
/* AIML tags from the beginning of the file */
/* and replacing them with our own tags */
/*******************************************************/
$validAIMLHeader = '<?xml version="1.0" encoding="[charset]"?>
<!DOCTYPE aiml PUBLIC "-//W3C//DTD Specification Version 1.0//EN" "http://www.program-o.com/xml/aiml.dtd">
<aiml version="1.0.1" xmlns="http://alicebot.org/2001/AIML-1.0.1">';
$validAIMLHeader = str_replace('[charset]', $default_charset, $validAIMLHeader);
$aimlTagStart = stripos($aimlContent, '<aiml', 0);
$aimlTagEnd = strpos($aimlContent, '>', $aimlTagStart) + 1;
$aimlFile = $validAIMLHeader . substr($aimlContent, $aimlTagEnd);
//die('<pre>' . htmlentities("File contents:<br />\n$aimlFile"));
try {
libxml_use_internal_errors(true);
$xml = new DOMDocument();
$xml->loadXML($aimlFile);
//$xml->validate();
$aiml = new SimpleXMLElement($xml->saveXML());
$rowCount = 0;
if (!empty($aiml->topic)) {
foreach ($aiml->topic as $topicXML) {
# handle any topic tag(s) in the file
$topicAttributes = $topicXML->attributes();
$topic = $topicAttributes['name'];
foreach ($topicXML->category as $category) {
$fullCategory = $category->asXML();
$pattern = $category->pattern;
$pattern = str_replace("'", ' ', $pattern);
$that = $category->that;
$template = $category->template->asXML();
$template = str_replace('<template>', '', $template);
$template = str_replace('</template>', '', $template);
$aiml_add = str_replace("\r\n", '', $fullCategory);
# Strip CRLF from category (windows)
$aiml_add = str_replace("\n", '', $aiml_add);
# Strip LF from category (mac/*nix)
$sql_add = str_replace('[aiml_add]', mysql_real_escape_string($aiml_add), $sql_template);
$sql_add = str_replace('[pattern]', $pattern, $sql_add);
$sql_add = str_replace('[that]', $that, $sql_add);
$sql_add = str_replace('[template]', mysql_real_escape_string($template), $sql_add);
$sql_add = str_replace('[topic]', $topic, $sql_add);
$sql .= "{$sql_add}";
$rowCount++;
if ($rowCount >= 100) {
$rowCount = 0;
$sql = rtrim($sql, ",\n") . ';';
$success = updateDB($sql) >= 0 ? true : false;
$sql = $sql_start;
}
}
}
}
if (!empty($aiml->category)) {
foreach ($aiml->category as $category) {
$fullCategory = $category->asXML();
$pattern = $category->pattern;
$pattern = str_replace("'", ' ', $pattern);
$that = $category->that;
$template = $category->template->asXML();
$template = str_replace('<template>', '', $template);
$template = str_replace('</template>', '', $template);
$aiml_add = str_replace("\r\n", '', $fullCategory);
# Strip CRLF from category (windows)
$aiml_add = str_replace("\n", '', $aiml_add);
# Strip LF from category (mac/*nix)
$sql_add = str_replace('[aiml_add]', mysql_real_escape_string($aiml_add), $sql_template);
$sql_add = str_replace('[pattern]', $pattern, $sql_add);
$sql_add = str_replace('[that]', $that, $sql_add);
$sql_add = str_replace('[template]', mysql_real_escape_string($template), $sql_add);
$sql_add = str_replace('[topic]', '', $sql_add);
$sql .= "{$sql_add}";
$rowCount++;
if ($rowCount >= 100) {
$rowCount = 0;
$sql = rtrim($sql, ",\n") . ';';
$success = updateDB($sql) >= 0 ? true : false;
$sql = $sql_start;
}
//.........这里部分代码省略.........
示例14: updateDB
<pre>
<?php
require_once "../init_database_data.php";
require_once $store_config['code'] . "stores/" . $store_config["dbms"] . "store_install.phtml";
$cache_store = $cache_config["dbms"] . "store_install";
$cachestore = new $cache_store(".", $cache_config);
function updateDB($store, $properties)
{
foreach ($properties as $name => $property) {
echo "\tAltering store_prop_{$name}\n";
if ($store->has_property($name)) {
$store->alter_property($name, $property);
} else {
$store->create_property($name, $property);
}
}
}
updateDB($store, $properties);
updateDB($cachestore, $cacheproperties);
?>
</pre>
示例15: header
<?php
header("Content-type: text/xml");
require_once 'Excel/reader.php';
//echo $numRows."<br/>";
//echo $numCols;
if (isset($_GET)) {
$startIndex = $_GET["startIndex"];
$endIndex = $_GET["endIndex"];
updateDB($startIndex, $endIndex);
}
//update the products based on the Excel
function updateDB($startIndex, $endIndex)
{
//need to copy the code that does the excel reading
$analysisData = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$analysisData->setOutputEncoding('CP1251');
$inputFileName = 'ReverseGeoCodingForStopsVerification.xls';
$analysisData->read($inputFileName);
error_reporting(E_ALL ^ E_NOTICE);
$numRows = $analysisData->sheets[0]['numRows'];
$numCols = $analysisData->sheets[0]['numCols'];
//echo $numRows.",".$numCols;
$strRoute = '<Routes>';
for ($i = $startIndex; $i <= $endIndex; $i++) {
$stopId = $analysisData->sheets[0]['cells'][$i][1];
$StopName = $analysisData->sheets[0]['cells'][$i][2];
$Buses = $analysisData->sheets[0]['cells'][$i][3];
$latitude = $analysisData->sheets[0]['cells'][$i][4];
$longitude = $analysisData->sheets[0]['cells'][$i][5];