Asf_Db_AbstractAdapter::update

数据行更新Adapter类

默认在SQL语句末尾增加 limit 1, 当参数$limit被设置成0时, 代表关闭update保险杠


Description

public bool update(array $data [, array $condition = array() [, int $limit = 1]])

Parameters

data

需要一个关联数组 key => value 键值对

condition

判断条件

limit

默认值1, 简称保险杠, 设置0关闭

SQLite 数据库不生效

Return Values

true 代表成功, false 代表失败

Examples

Example #1 Connect MySQL Database

<?php
$configs = array(
    'dsn' => array('host' => '127.0.0.1', 'dbname' => 'test', 'port' => 6666),
    'username' => 'test',
    'password' => 'AbcdefRDvgedf',
);

$mysql = new Asf_Db_Adapter_Mysql($configs);
$mysql->setTableName('test1');

// UPDATE `test1` SET `pass` = ? WHERE `user` = ?
// bindValue: time(), lisi
$data = array('pass' => time());
$where = array('user' => 'lisi');
var_dump($mysql->update($data, $where));