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


PHP Table::update方法代码示例

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


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

示例1: testUpdate

 public function testUpdate()
 {
     $row = $this->table->create(array())->current();
     $data = array("created" => new \pq\DateTime("2013-03-03 03:03:03"), "counter" => 2, "number" => 2.2, "data" => "this is a test", "list" => array(3, 2, 1), "prop" => null);
     $row = $this->table->update(array("id = " => $row->id), $data)->current();
     $data = array("id" => $row->id->get()) + $data;
     $this->assertEquals($data, $row->getData());
 }
开发者ID:m6w6,项目名称:pq-gateway,代码行数:8,代码来源:TableTest.php

示例2: _doUpdate

 /**
  * @return mixed The primary key value(s), as an associative array if the
  *	 key is compound, or a scalar if the key is single-column.
  */
 protected function _doUpdate()
 {
     /**
      * Get expressions for a WHERE clause
      * based on the primary key value(s).
      */
     $where = $this->_getWhereQuery(false);
     /**
      * Compare the data to the modified fields array to discover
      * which columns have been changed.
      */
     $diffData = array_intersect_key($this->getArrayCopy(), $this->_cleanData);
     /**
      * Execute the UPDATE (this may throw an exception)
      * Do this only if data values were changed.
      * Use the $diffData variable, so the UPDATE statement
      * includes SET terms only for data values that changed.
      */
     if (count($diffData) > 0) {
         $this->_table->update($diffData, $where);
     }
     /**
      * Return the primary key value(s) as an array
      */
     $primaryKey = $this->_getPrimaryKey(true);
     return $primaryKey;
 }
开发者ID:shen2,项目名称:mdo,代码行数:31,代码来源:TableTrait.php

示例3: testUpdateData

 public function testUpdateData()
 {
     $table = new Table(__DIR__ . '/data/sample.json');
     $this->assertSame([['_id' => '2', 'name' => 'bar']], $table->find(['_id' => '2']));
     $table->update(['_id' => '2'], ['name' => 'gaz']);
     $this->assertSame([['_id' => '2', 'name' => 'gaz']], $table->find(['_id' => '2']));
 }
开发者ID:mhujer,项目名称:json-simple-db,代码行数:7,代码来源:TableTest.php

示例4: SetState

 public static function SetState($team)
 {
     if ($team['now_number'] >= $team['max_number']) {
         $team['state'] = 'soldout';
     } else {
         if ($team['now_number'] >= $team['min_number']) {
             $team['state'] = 'success';
         } else {
             $team['state'] = 'failuer';
         }
     }
     $team['close_time'] = $team['close_time'] ? $team['close_time'] : strtotime(date('Y-m-d'));
     $table = new Table('team', $team);
     $table->update(array('close_time', 'state'));
     self::SetOrderState($team);
 }
开发者ID:jowino,项目名称:bd786110cact,代码行数:16,代码来源:ZTeam.class.php

示例5: exit

    if (empty($mysqlRs)) {
        exit("所有数据处理完毕!");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["id"];
        if (!strstr($value["redword"], "+")) {
            continue;
        }
        echo $value["keyword"] . "\n";
        echo $value["redword"];
        echo "\n";
        $redword = str_replace("+", "", $value["redword"]);
        $redword = preg_replace("/[\\s]+/is", " ", $redword);
        echo $redword;
        echo "\n";
        $conn->update("update gckeyword.key_proword set redword = '" . $redword . "' where id = '" . $value["id"] . "'");
        try {
            $beanstalk->choose('v3www_prokeyword_cachewrite');
            echo $beanstalk->put($value["keyword"], array('priority' => 1024, 'delay' => 0, 'ttr' => 86400)), "\n";
        } catch (\Exception $e) {
        }
        exit;
    }
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
}
class Table
{
开发者ID:tianyunchong,项目名称:php,代码行数:31,代码来源:redword.php

示例6: template

<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_partner();
$id = abs(intval($_GET['id']));
$ask = Table::Fetch('ask', $id);
$partner_id = abs(intval($_SESSION['partner_id']));
need_biz_auth($ask['partner_id'] == $partner_id);
if (!$ask) {
    redirect(WEB_ROOT . '/biz/ask.php');
}
if ($ask['type'] == 'transfer' && empty($ask['comment'])) {
    $ask['comment'] = '顶';
}
if ($_POST && $id == $_POST['id']) {
    $table = new Table('ask', $_POST);
    $table->update(array('comment', 'content'));
    redirect(udecode($_GET['r']));
}
$team = Table::Fetch('team', $ask['team_id']);
$user = Table::Fetch('user', $ask['user_id']);
include template('biz_askedit');
开发者ID:hhdem,项目名称:tuangala_v2,代码行数:22,代码来源:askedit.php

示例7: dirname

<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_partner();
$partner_id = abs(intval($_SESSION['partner_id']));
$login_partner = Table::Fetch('partner', $partner_id);
foreach ($_GET as $key => $val) {
    if ($val == 'Checkoff') {
        $coupon = Table::Fetch('coupon', $key);
        $array = array('consume', 'consume_time');
        $coupon['consume'] = 'Y';
        $coupon['consume_time'] = time();
        $table = new Table('coupon', $coupon);
        $flag = $table->update($array);
        if ($flag) {
            Session::Set('notice', 'coupon has been Checkoff.');
        }
    } elseif ($val == 'Print') {
        print_r("this is priint");
    }
}
$title = strval($_GET['title']);
$condition = $t_con = array('partner_id' => $partner_id);
if ($title) {
    $t_con[] = "title like '%" . mysql_escape_string($title) . "%'";
    $teams = DB::LimitQuery('team', array('condition' => $t_con));
    $team_ids = Utility::GetColumn($teams, 'id');
    if ($team_ids) {
        $condition['team_id'] = $team_ids;
    } else {
        $title = null;
开发者ID:jowino,项目名称:bd786110cact,代码行数:31,代码来源:coupon.php

示例8: abs

need_manager();
need_auth('market');

$finance_id = abs(intval($_GET['id']));

if (!$finance_id || !$finance = Table::FetchForce('finance', $finance_id) ) {
	Session::Set('error', '结算信息不存在');
	redirect( WEB_ROOT . '/manage/partner/index.php' );
}

if(is_post()){
	$table = new Table('finance', array('id'=>$finance_id, 'tell'=>'', 'remark'=>'', 'method'=>''));
	$table->tell = trim(strval($_POST['tell']));
	$table->remark = trim(strval($_POST['remark']));
	$table->method = trim(strval($_POST['method']));
	$table->update(array('tell', 'remark', 'method',));
	Session::Set('notice', '更新结算信息成功,不可更改结算时间');
	redirect( WEB_ROOT . '/manage/partner/showcalculate.php?id='.$finance_id);
}


$sql = "SELECT COUNT(*) AS num, team_id FROM `coupon` WHERE `consume_time` <= ".$finance['end_time']." AND `consume_time` > ".$finance['begin_time']." AND `partner_id` = ".$finance['partner_id']." AND `consume` = 'Y' GROUP BY `team_id`";
$coupons = DB::GetQueryResult($sql, false);
//die(print_R($coupons));
$coupons_count = count($coupons);
list($pagesize, $offset, $pagestring) = pagestring($coupons_count, 20);
$sql .= ' LIMIT '.$offset.','.$pagesize;
$coupons = DB::GetQueryResult($sql, false);

$team_ids = Utility::GetColumn($coupons, 'team_id');
$teams = Table::Fetch('team', $team_ids);
开发者ID:noikiy,项目名称:mdwp,代码行数:31,代码来源:showcalculate.php

示例9: Table

		$partner = Table::Fetch('partner', $_POST['id']);
		if($partner['fid']!=$partner_id) {
			Session::Set('error', '请合法操作,该账号不属于你的管理');
			redirect( WEB_ROOT . '/m_biz/account.php');
		}

		$table = new Table('partner', $_POST);
		$table->SetStrip('location', 'other');
		//check username
		$table->username = $p_username = trim(strval($table->username));
		$u_partner = Table::Fetch('partner', $p_username, 'username');
		if($u_partner){
			Session::Set('error', '该用户名已存在');
			redirect( WEB_ROOT . '/m_biz/changeusername.php?id='.$partner['id']);
		}
		$result = $table->update(array('username',
		));
		if(!$result){
			Session::Set('error', '账号信息修改失败');
			redirect( WEB_ROOT . '/m_biz/changeusername.php?id='.$partner['id']);
		}else{
			Session::Set('notice', '账号信息修改成功');
			redirect( WEB_ROOT . '/m_biz/account.php');
		}
	}else{
		Session::Set('error', '密码输入错误');
		redirect( WEB_ROOT . '/m_biz/account.php');
	}
}


开发者ID:noikiy,项目名称:mdwp,代码行数:29,代码来源:changeusername.php

示例10: array

    $table->image = upload_image('upload_image', $team['image'], 'team');
    $table->image1 = upload_image('upload_image1', $team['image1'], 'team', 380);
    $table->image2 = upload_image('upload_image2', $team['image2'], 'team', 380);
    $error_tip = array();
    if (!$error_tip) {
        if ($table->update($insert)) {
            if ($_POST['charity_id'] != 0) {
                if ($_POST['deal_charity_id'] != "") {
                    $dealcharity['id'] = $_POST['deal_charity_id'];
                }
                $dealcharity['charity_id'] = $_POST['charity_id'];
                $dealcharity['value'] = str_replace('%', '', $_POST['charityvalue']);
                $dealcharity['deal_id'] = $_POST['id'];
                $dcTable = new Table('deals_charity', $dealcharity);
                $dealinsert = array('charity_id', 'value', 'deal_id');
                $dcTable->update($dealinsert);
            }
            Session::Set('notice', 'Modify deal information successfully');
            Utility::Redirect(WEB_ROOT . "/manage/team/index.php");
        } else {
            Session::Set('error', 'Modify team information failed, check your system setting please.');
        }
    }
}
$charity = Table::Fetch('deals_charity', $id, 'deal_id');
if ($charity) {
    $charityvalue = $charity['value'] . '%';
}
$groups = DB::LimitQuery('category', array('condition' => array('zone' => 'group')));
$groups = Utility::OptionArray($groups, 'id', 'name');
$partners = DB::LimitQuery('partner', array('order' => 'ORDER BY id DESC'));
开发者ID:jowino,项目名称:bd786110cact,代码行数:31,代码来源:edit.php

示例11: __construct

 */
$file = "keyword.txt";
$fp = fopen($file, "r");
$conn = new Table("txonline");
while (!feof($fp)) {
    $line = fgets($fp);
    $keyword = trim($line);
    if (empty($keyword)) {
        continue;
    }
    $keywordRs = $conn->findOne("select id, keyword from gckeyword.key_proword where keyword = '{$keyword}' limit 1");
    if (empty($keywordRs)) {
        continue;
    }
    echo $keyword . "\n";
    $conn->update("update gckeyword.key_proword set is_select = 0 where id = '" . $keywordRs["id"] . "'");
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
}
class Table
{
    public $conn = '';
    public $config;
    public function __construct($connName)
    {
        $db = Config::$dbArr;
        $this->config = $db[$connName];
        try {
开发者ID:tianyunchong,项目名称:php,代码行数:31,代码来源:keywordSelect.php

示例12: template

<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_login();
if ($_POST) {
    $table = new Table('user', $_POST);
    $table->SetPk('id', $login_user_id);
    $update = array('username', 'realname', 'zipcode', 'address', 'mobile', 'avatar');
    if ($table->password == $table->password2 && $table->password) {
        $update[] = 'password';
        $table->password = ZUser::GenPassword($table->password);
    }
    $table->avatar = upload_image('upload_image', $login_user['avatar'], 'user');
    $table->update($update);
    Utility::Redirect(WEB_ROOT . '/account/settings.php ');
}
include template('account_settings');
开发者ID:jowino,项目名称:bd786110cact,代码行数:17,代码来源:settings.php

示例13: team_state

function team_state(&$team)
{
    if ($team['max_number'] > 0 && $team['now_number'] >= $team['max_number']) {
        if ($team['close_time'] == 0) {
            $team['close_time'] = $team['end_time'];
        }
        return $team['state'] = 'soldout';
    } else {
        if ($team['end_time'] <= time()) {
            $team['close_time'] = $team['end_time'];
            if ($team['now_number'] < $team['min_number']) {
                $team['state'] = 'failure';
                $table = new Table('team', $team);
                $table->update(array('close_time', 'state'));
                return $team['state'] = 'failure';
            }
            return $team['state'] = 'success';
        }
    }
    return $team['state'] = 'none';
}
开发者ID:jowino,项目名称:bd786110cact,代码行数:21,代码来源:common.php

示例14: Table

		$store = Table::Fetch('store', $_POST['store_id']);
		if($store['partner_id']!=$partner_id) {
			Session::Set('error', '请合法操作,该门店不属于你的管理');
			redirect( WEB_ROOT . '/m_biz/index.php');
		}

		$partner = Table::Fetch('partner', $_POST['id']);
		if($partner['fid']!=$partner_id) {
			Session::Set('error', '请合法操作,该账号不属于你的管理');
			redirect( WEB_ROOT . '/m_biz/account.php');
		}

		$table = new Table('partner', $_POST);
		$table->SetStrip('location', 'other');
		$table->password = ZPartner::GenPassword($_POST['password']);
		$result = $table->update(array('password',));
		if(!$result){
			Session::Set('error', '密码修改失败');
			redirect( WEB_ROOT . '/m_biz/changeusername.php?id='.$partner['id']);
		}else{
			Session::Set('notice', '账号信息修改成功');
			redirect( WEB_ROOT . '/m_biz/account.php');
		}
	}else{
		Session::Set('error', '密码输入错误');
		redirect( WEB_ROOT . '/m_biz/account.php');
	}
}


开发者ID:noikiy,项目名称:mdwp,代码行数:28,代码来源:changepass.php

示例15: getCateNew

    $newEnd = $new4;
} elseif ($new3) {
    $newEnd = $new3;
} elseif ($new2) {
    $newEnd = $new2;
}
$oldEnd = 0;
if ($old4) {
    $oldEnd = $old4;
} elseif ($old3) {
    $oldEnd = $old3;
} elseif ($old2) {
    $oldEnd = $old2;
}
/* 更新下新分类里的末级分类 */
$conn->update("update forbuyscateinfo.fbcate_cateinfo set is_leaf = 1 where cateid = '" . $newEnd . "'");
/* 将old分类里的末级分类标记为is_map*/
$conn->update("update forbuyscateinfo.f_cate set is_map = 1 where cid = '" . $oldEnd . "'");
/* 绑定下对应关系 */
$insertArr = array("old1" => $old1, "old2" => $old2, "old3" => $old3, "old4" => $old4, "new1" => $new1, "new2" => $new2, "new3" => $new3, "new4" => $new4);
$conn->insert($insertArr, "forbuyscateinfo.fbcate_catemap");
output("分类copy并且对应成功!", "http://catemap.forbuyers.cn/map.php");
function getCateNew($catename)
{
    global $conn;
    $result = $conn->findOne("select cateid, catename, parentid from forbuyscateinfo.fbcate_cateinfo where catename = '{$catename}' limit 1");
    if (empty($result)) {
        return array();
    }
    return $result;
}
开发者ID:tianyunchong,项目名称:php,代码行数:31,代码来源:copyAdd.php


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