我目前正在努力解决以下问题:
$res = $db->uniquequery("SELECT distinct won_current,ctt,darkmatter FROM ".USERS." WHERE `id` = '".$USER['id']."'");
$checkwon = $res['won_current'];
$ct=$res['ctt'];
$dm=$res['darkmatter'];
这些似乎正在工作。现在...
$dmgift=0;
while($checkwon>=1000)
{
$ct=$ct+1;
//incrementing $ct doesnt seem to work in the loop but it works fine outside it
$checkwon=$checkwon-1000;
//threshold ranges and setting of dmgift.
switch($ct){
case $ct=1 : $dmgift=25000;break;
case $ct>=5 && $ct<10: $dmgift=50000;break;
case $ct>=10 && $ct<15: $dmgift=75000;break;
case $ct>=15 && $ct<20: $dmgift=100000;break;
case $ct>=20 : $dmgift=150000;break;
}
$dm=$dm+$dmgift;
//$db->query("UPDATE ".USERS." SET won_current=$checkwon,ctt=$checkthreshold,darkmatter=$dm WHERE `id` = ".$USER['id'].";");
$db->query("UPDATE ".USERS." SET won_current=$checkwon WHERE `id` = ".$USER['id'].";");
$db->query("UPDATE ".USERS." SET ctt='$ct' WHERE `id` = ".$USER['id'].";"); // this update query is not passing.db field remains the same
$db->query("UPDATE ".USERS." SET darkmatter=$dm WHERE `id` = ".$USER['id'].";");
}
请告知...其他 2 个更新查询顺利通过...如果您注意到以上 3 个更新,我有一个完整的查询在其中评论...拆分它以查看更新中不起作用的内容...我确实回显并vardump...在循环之外他们给了我正确的值...但是在循环内部他们有我 11111 而不是 5...例如...不知道我做错了什么...我是对 php 非常陌生(2 天?),希望有一个解决方案......