本文整理匯總了PHP中dbex::lastInsertId方法的典型用法代碼示例。如果您正苦於以下問題:PHP dbex::lastInsertId方法的具體用法?PHP dbex::lastInsertId怎麽用?PHP dbex::lastInsertId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dbex
的用法示例。
在下文中一共展示了dbex::lastInsertId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: task
}
// 扣錢成功,寫task表
$sql = "insert into task (owner_id, publisher_id, type, base_price, amount, status, create_at, expire_in) values('{$_SESSION['uid']}', '{$_SESSION['uid']}', 1, '{$db_base_price}', '{$amount}', 1, now(), '{$expire_in_sec}')";
$num = $dbo->exeUpdate($sql);
if (1 != $num) {
// 寫數據表失敗,回滾金錢數據
$sql2 = "update user set realtime_money=realtime_money + {$db_total_price} where user_id = '{$_SESSION['uid']}' limit 1";
$num2 = $dbo->exeUpdate($sql2);
if (1 != $num2) {
$msg = "回滾金錢數據失敗,這個比較糟糕。SQL:" . $sql2;
debug($msg, __FILE__, __LINE__);
}
$msg = '數據庫task表插入出錯,SQL:' . $sql;
debug($msg, __FILE__, __LINE__);
}
$last_task_id = $dbo->lastInsertId();
$text = $dbo->real_escape_string($status['text']);
$screen_name = $dbo->real_escape_string($status['user']['screen_name']);
$location = $dbo->real_escape_string($status['user']['location']);
$description = $dbo->real_escape_string($status['user']['description']);
$sql = "insert into task_info_sina_repost values(NULL, '{$last_task_id}', '{$_SESSION['sid']}', '{$wid}', '{$text}', '{$screen_name}', '{$location}', '{$description}', '{$status['user']['profile_image_url']}', '{$status['thumbnail_pic_url']}', '{$status['bmiddle_pic_url']}', '{$status['original_pic_url']}')";
$num = $dbo->exeUpdate($sql);
if (1 != $num) {
$msg = '數據庫插入數據出錯。SQL:' . $sql;
debug($msg, __FILE__, __LINE__);
// 回滾金錢數據和task表數據
$sql1 = "delete from task where task_id = '{$last_task_id}' limit 1";
$num1 = $dbo->exeUpdate($sql1);
$sql2 = "update user set realtime_money = realtime_money + {$db_total_price} where user_id = '{$_SESSION['uid']}' limit 1";
$num2 = $dbo->exeUpdate($sql2);
if (1 != $num1) {