当前位置: 首页>>代码示例>>PHP>>正文


PHP MySQL::update方法代码示例

本文整理汇总了PHP中MySQL::update方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::update方法的具体用法?PHP MySQL::update怎么用?PHP MySQL::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySQL的用法示例。


在下文中一共展示了MySQL::update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isLoggedIn

 /**
  * This function determines whether an there is a currently logged in
  * Author for Symphony by using the `$Cookie`'s username
  * and password. If an Author is found, they will be logged in, otherwise
  * the `$Cookie` will be destroyed.
  *
  * @see core.Cookie#expire()
  */
 public function isLoggedIn()
 {
     // Ensures that we're in the real world.. Also reduces three queries from database
     // We must return true otherwise exceptions are not shown
     if (is_null(self::$_instance)) {
         return true;
     }
     if ($this->Author) {
         return true;
     } else {
         $username = self::$Database->cleanValue($this->Cookie->get('username'));
         $password = self::$Database->cleanValue($this->Cookie->get('pass'));
         if (strlen(trim($username)) > 0 && strlen(trim($password)) > 0) {
             $id = self::$Database->fetchVar('id', 0, "SELECT `id` FROM `tbl_authors` WHERE `username` = '{$username}' AND `password` = '{$password}' LIMIT 1");
             if ($id) {
                 self::$Database->update(array('last_seen' => DateTimeObj::get('Y-m-d H:i:s')), 'tbl_authors', " `id` = '{$id}'");
                 $this->Author = AuthorManager::fetchByID($id);
                 Lang::set($this->Author->get('language'));
                 return true;
             }
         }
         $this->Cookie->expire();
         return false;
     }
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:33,代码来源:class.symphony.php

示例2: array

 case "delete":
     $log_info = $setting['language']['admin_art_tag_delete'];
     $tag = $db->result($setting['db']['pre_sub'] . "news_tag", "tag", array("id", "n=", $id));
     $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => ''), array("id", "n=", $id));
     $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => "REPLACE(tag, '" . $tag . ",', '')"), array("tag", "like", $tag));
     $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => "REPLACE(tag, '," . $tag . "', '')"), array("tag", "like", $tag));
     $db->delete($setting['db']['pre_sub'] . "news_tag", array("id", "n=", $id));
     break;
 case "rebuild":
     set_time_limit(0);
     $log_info = $setting['language']['admin_art_tag_rebuild'];
     $db_tmp = new MySQL();
     $db_tmp->init($setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']);
     $db_tmp->Connect(false);
     $db_tmp->SelectDB($setting['db']['name']);
     $db_tmp->update($setting['db']['pre_sub'] . "news_tag", array("count" => 0));
     $db->ReConnect(true, $setting['db']['name']);
     $n = 1;
     $db->select($setting['db']['pre_sub'] . "news_show", "news_id, tag", array(), array("order" => "news_id"));
     while ($record = $db->GetRS()) {
         $the_tag = $record['tag'];
         $the_tag = str_replace("¡¢", ",", $the_tag);
         $the_tag = str_replace("£¬", ",", $the_tag);
         $the_tag = str_replace("¡¡", " ", $the_tag);
         $the_tag = str_replace(" ", "_", $the_tag);
         $the_tag = explode(",", $the_tag);
         $max_count = count($the_tag);
         for ($n = 0; $n < $max_count; $n++) {
             $the_tag[$n] = trim($the_tag[$n], "_");
             $the_tag[$n] = mysql_real_escape_string($the_tag[$n]);
             if (strlen($the_tag[$n]) < 3 || preg_match("/[\\d\\.]+/", $the_tag[$n])) {
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:art_tag.php

示例3: deletehtml

     } else {
         $link =& $v;
         $sqlSearch = 'SELECT id ';
         $sqlSearch .= 'FROM ' . TB_LINKS . ' ';
         $sqlSearch .= 'WHERE url = \'' . $link . '\' ';
         $sqlSearch .= 'Limit 1';
         $rs = $db->query($sqlSearch);
         if (!$rs->next_record()) {
             ++$dataCount;
             $dataFids['id'] = '';
             $dataFids['title'] = deletehtml(addslashes($linksList['title'][$k]));
             $dataFids['url'] = addslashes(str_replace('&amp;', '&', $link));
             $dataFids['rules'] = $_GET['ID'];
             $dataFids['date'] = strtotime(date('Y-m-d H:i:s'));
             $sql = $NBS->add($dataFids);
             $db->update($sql);
             continue;
         } else {
             ++$existsCount;
             continue;
         }
         continue;
     }
 }
 $finishBaseURL = '?module=collectionLink&action=finish&ID=' . $_GET['ID'];
 $nextAlertTitle = '继续采集...';
 $nextAlertMessage = '继续采集下一页索引的连接.请不要关闭本页.';
 $finishAlertTitle = '采集完成...';
 $finishAlertMessage = '连接采集完成,现在开始统计结果.';
 if ($_GET['type'] == 1) {
     $gotoURL = $finishBaseURL . '&dataCount=' . $dataCount . '&existsCount=' . $existsCount;
开发者ID:antiwise,项目名称:collect,代码行数:31,代码来源:link_collection.php

示例4: NEATBulidSql

    $tp->assign('linkNum', $rs->get('link_num'));
    $tp->assign('importNum', $rs->get('import_num'));
    $moduleTemplate = $tp->result();
    $moduleTitle = '清空采集器数据';
} else {
    $NBS = new NEATBulidSql(TB_LINKS);
    if ($_POST['link']) {
        $NBS->setTable(TB_LINKS);
        $linkFids['rules'] = $_GET['ID'];
        $sql = $NBS->del($linkFids);
        $NDB->query($sql);
        $NBS->setTable(TB_RULES);
        $conditionFids['id'] = $_GET['ID'];
        $rulesFids['link_num'] = 0;
        $sql = $NBS->update($rulesFids, $conditionFids);
        $NDB->update($sql);
    }
    if ($_POST['data']) {
        $NBS->setTable(TB_DATA);
        $dataFids['rules'] = $_GET['ID'];
        $sql = $NBS->del($dataFids);
        $NDB->query($sql);
        $NBS->setTable(TB_RULES);
        $conditionFids['id'] = $_GET['ID'];
        $rulesFids['import_num'] = 0;
        $sql = $NBS->update($rulesFids, $conditionFids);
        $NDB->update($sql);
    }
    showloading('?module=listRules', '清空成功', '编号为 ' . $_GET['ID'] . ' 的采集器的数据清空成功,现在返回采集器列表.');
    $tpShowBody = false;
}
开发者ID:antiwise,项目名称:collect,代码行数:31,代码来源:rules_clear.php

示例5: error

<?php

if (!$_GET['ID']) {
    error('导入配置编号不能为空!');
}
if (!is_numeric($_GET['ID'])) {
    error('导入配置编号只能是数字!');
}
$sql = 'DELETE ';
$sql .= 'FROM ' . TB_DB2DB . ' ';
$sql .= 'WHERE id = ' . $_GET['ID'];
$db = new MySQL(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);
$rs = $db->update($sql);
$db->disconnect();
showloading('?module=listDB', '删除成功...', '编号为' . $_GET['ID'] . '的导入规则已经被成功删除,现在返回导入规则列表');
$tpShowBody = false;
开发者ID:antiwise,项目名称:collect,代码行数:16,代码来源:db_del.php

示例6: error

            error('连接编号只能是数字');
        }
    }
    $idNum = count($adoptID);
    foreach ($adoptID as $k => $v) {
        ++$i;
        $sqlIDList .= $v;
        if ($i < $idNum) {
            $sqlIDList .= ', ';
            continue;
        }
    }
    $updateSql = 'UPDATE ' . TB_LINKS . ' SET ';
    $updateSql .= $adoptSql;
    $updateSql .= '	WHERE id IN (' . $sqlIDList . ')';
    $db->update($updateSql);
    $sql = 'DELETE ';
    $sql .= 'FROM ' . TB_DATA . ' ';
    $sql .= 'WHERE link_id ';
    $sql .= 'IN (' . $sqlIDList . ')';
    $db->update($sql);
} else {
    $totalSql = 'SELECT COUNT(*) AS total FROM ' . TB_LINKS . ' ';
    $totalSql .= ' WHERE rules = ' . $_GET['rules'] . ' ';
    $totalrs = $db->query($totalSql);
    $totalrs->next_record();
    $idNum = $totalrs->get('total');
    $updateSql = 'UPDATE ' . TB_LINKS . ' SET ';
    $updateSql .= $adoptSql;
    $updateSql .= '	WHERE rules = ' . $_GET['rules'] . ' ';
    $db->update($updateSql);
开发者ID:antiwise,项目名称:collect,代码行数:31,代码来源:adopt.php

示例7: error

        ++$i;
    }
    $tp->set_templatefile('templates/db_import_form.html');
    $tp->assign('ID', $_GET['ID']);
    $tp->assign($list);
    $moduleTemplate = $tp->result();
    $moduleTitle = '数据导入';
} else {
    if ($_GET['action'] == 'saveRules') {
        if (!$_POST['rulesID']) {
            error('你还没有选择要更新的采集器呢......');
        }
        $rules = implode(',', $_POST['rulesID']);
        $updateSql = 'UPDATE ' . TB_DB2DB . ' SET ';
        $updateSql .= ' rules = \'' . $rules . '\' WHERE id = ' . $_GET['ID'];
        $db->update($updateSql);
        showloading('index.php?module=importDB&ID=' . $_GET['ID'], '保存采集器成功...', '保存采集器列表成功,请进行导入设置.');
        $tpShowBody = false;
        exit;
    } else {
        if ($_GET['action'] == 'getReady') {
            if (!$_POST['eachTimes']) {
                error('请您输入每次采集的条数');
            }
            if (!is_numeric($_POST['eachTimes'])) {
                error('每次采集条数只能是数字');
            }
            if ($_POST['eachTimes'] < 0) {
                error('每次采集条数不能是负数');
            }
            $eachTimes = $_POST['eachTimes'];
开发者ID:antiwise,项目名称:collect,代码行数:31,代码来源:db_import.php

示例8: mysql_query

<?php

$columns = MySQL::getColumns($_GET['table']);
$res = mysql_query("SELECT * FROM \n            " . mysql_real_escape_string($_GET['table']) . " \n\t\t\tLIMIT " . mysql_real_escape_string($_GET['position']) . ",1");
$data = mysql_fetch_assoc($res);
if ($_POST['save']) {
    $olddata = $data;
    foreach ($data as $key => $value) {
        if (isset($_POST[$key])) {
            $data[$key] = $_POST[$key];
        }
    }
    echo MySQL::update($data, $olddata, $_GET['table']);
}
function getColumnSize($type)
{
    if (strpos($type, "(") > -1 && strpos($type, ")") > -1) {
        return substr($type, strpos($type, "(") + 1, strpos($type, ")") - strpos($type, "(") - 1);
    } else {
        return false;
    }
}
?>
<script language="JavaScript">
  function isInteger(s) {
    return (s.toString().search(/^-?[0-9]+$/) == 0);
  }
  function validate(name,type,value){
    if(type.substring(0,3) == 'int'){
	  if(!isInteger(value)){
        alert('Das Feld ' + name + ' muss vom Typ Integer sein.');
开发者ID:srueegger,项目名称:1zu12bB,代码行数:31,代码来源:tableitem-edit.php


注:本文中的MySQL::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。