各位大神,我修改某小說程式,遇到php讀取mysql的問題。一路過關斬將,不想卡在最后一個帶有判斷事務是否成功的存盤程序的@out回傳值得的獲得上了。請大大一定要幫幫我啊!!!
01 我先列出php內容----
$query = JieqiQueryHandler::getInstance("JieqiQueryHandler"); //宣告一個新查詢實體
$u_q=@mysql_query("CALL lesgl.01(JIEQI_NOW_TIME,$uid,1000,@jieguo)") ; //執行陳述句
$jieguo = @mysql_result($u_q,0,'select @jieguo'); //資料表不同,欄位也不同 【都@了。因為不@就直接出錯】
02 存盤程序代碼-------------------------
四個引數
shijian int 20 時間戳
id int
newgole int 新的網站代幣一般1000
jieguo int 事務是否成功的回傳值 out
BEGIN
declare u1 int;
declare ok integer default 0; # 定義回傳結果并賦初值0
declare continue handler for sqlexception set ok =1; #有任何錯都是1
declare continue handler for not found set ok = 2; #沒有下一條為2
set u1 = (SELECT `egold` FROM `jieqi_system_users` WHERE `uid` = id); #當前代幣數量
set u1 = u1 + newegole; #加上充值內容
start transaction; #開始事務
INSERT INTO `lesgl`.`jieqi_pay_paylog`
(`payid` , `siteid` ,`buytime` ,`buyid` ,`money` ,`egoldtype` ,`egold` ,`paytype` ,`payflag`)
VALUES
(NULL , '0', shijian, id, newegole, '0', newegole, '微信', '1');
UPDATE `jieqi_system_users` SET `egold`= u1 WHERE `uid` = id;
if ok = 1 then
ROLLBACK; #回滾
set jieguo = 0;
select jieguo;
else
COMMIT; #提交
set jieguo = 1;
select jieguo;
end if;
END
------------------------
請大大一定要幫幫我!跪求!!!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/73715.html
標籤:MySQL
上一篇:mysql中空間資料型別的數字長度被限制為6位,怎么修改?
下一篇:mysql 報錯query builder does not support this syntax near "trigger"
