我希望程序忽略零总计。我试图阻止对零参与者的非参与者的汽车奖励。我在&& amp;之后添加了> =表达式。运营商。对于杀戮和净值是否正确?
$fetch_nor_killers = mysql_query("SELECT wk,bk,hk,dk,pk,mk, code, p, (wk+bk+hk+dk+pk+mk) as totalKills FROM r$round[round]_p WHERE status = '". normal ."' ORDER BY totalKills DESC LIMIT 3");
$killa_rank = 0;
while($killa = mysql_fetch_array($fetch_nor_killers))
{
$killa_rank++;
if($killa_rank == 1 && $killa['totalKills'] >= 1)
{
$killa_award = "freeopkiller1";
}
else
if($killa_rank == 2 && $killa['totalKills'] >= 1)
{
$killa_award = "freeopkiller2";
}
else
if($killa_rank == 3 && $killa['totalKills'] >= 1)
{
$killa_award = "freeopkiller3";
}
这与networth相同。只是试图避免授予失活用户。 @Jagrut
$fetch_top_subs = mysql_query("SELECT * FROM r$round[round]_p WHERE subscription != '". none ."' ORDER BY networth DESC LIMIT 3");
$sub_rank = 0;
while($sub = mysql_fetch_array($fetch_top_subs))
{
$sub_rank++;
if($sub_rank == 1 && $sub_rank['networth'] >= 1)
{
$sub_award = "first_sub";
}
else
if($sub_rank == 2 && $sub_rank['networth'] >= 1)
{
$sub_award = "second_sub";
}
即将测试这些。
答案 0 :(得分:0)
首先,我希望你对这个问题更加清楚。但根据我的理解,这可能是你的代码的问题:
您正在直接使用$totalKills
。您可以将其分配给变量然后使用它,或者您需要使用$killa
来访问$totalKills
,即
将其用作:
$anyVar = $killa['totalKills'];
然后使用$anyVar
进行操作,或直接使用$killa['totalKills']
代替$totalKills
。
希望这会有所帮助。