Medoo

开始

更新日志

Where 语句

查询

聚合

Fetch

事务

原生SQL查询

Raw object

PDO object

Debug

数据库信息

update

修改表数据

update($table, $data, $where)
Return: [number] 受影响的行数.
你可以修改没有序列化的数组, 并且能使用 [+], [-], [*], [/] 来做运算
class Foo {
	var $bar = "cat";

	public function __wakeup()
	{
		$this->bar = "dog";
	}
}

$object_data = new Foo();

$fp = fopen($_FILES[ "file" ][ "tmp_name" ], "rb");

$database->update("account", [
	"type" => "user",

	// All age plus one
	"age[+]" => 1,

	// All level subtract 5
	"level[-]" => 5,

	// All score multiplied by 2
	"score[*]" => 2,

	// Array value
	"lang" => ["en", "fr", "jp", "cn"],

	// Array value encoded as JSON
	"lang [JSON]" => ["en", "fr", "jp", "cn"],

	// Boolean value
	"is_locked" => true,

	// Object value
	"object_data" => $object_data,

	// Large Objects (LOBs)
	"image" => $fp,

	// You can also assign # for using SQL functions
	"#uid" => "UUID()"
], [
	"user_id[<]" => 1000
]);

// The return object of update() is PDOStatement, so you can use its methods to get more information.
$data = $database->update("account", [
	"age[+]" => 1
], [
	"user_id[>]" => 100
]);

// Returns the number of rows affected by the last SQL statement
echo $data->rowCount();

// Read more: http://php.net/manual/en/class.pdostatement.php