|
PHP代码:
PHP复制代码
$this->db->trans_start();
$this->db->query("INSERT INTO `cdb_user_log` (`uid`, `type`, `ip_address`, `content`, `dateline`) VALUES (2921538, 0, '123', 'content', 1361351834)");
$this->db->query("UPDATE `cdb_user_log` SET `ip_address` = '192.168.0.118', `content` = 'set', `dateline` = 1361351863 WHERE `uid` < 1");
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback();
}
else
{
$this->db->trans_commit();
}
复制代码
数据库:
SQL复制代码
CREATE TABLE `cdb_user_log` (`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,`uid` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',`type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',`ip_address` VARCHAR(45) NOT NULL DEFAULT '',`content` VARCHAR(255) NOT NULL DEFAULT '',`dateline` INT(10) UNSIGNED NOT NULL DEFAULT '0',PRIMARY KEY (`id`),INDEX `uid` (`uid`))COLLATE='utf8_general_ci'ENGINE=InnoDB; 复制代码
请指点一下,谢谢~~
|
|