如何在此功能中添加该检查?

时间:2013-11-07 23:47:48

标签: php sql-server

我添加了$loyalty = $check["Loyalty"];,但我不确定如果Loyalty小于2000,请添加检查,然后显示消息:You cannot register because you have less than 2000 Loyalty.

http://pastebin.com/abDdgSA

如果有人告诉我应该怎么做,我将非常感激,所以我不会破坏代码。 谢谢!

1 个答案:

答案 0 :(得分:0)

$loyalty = $sorgu["Loyalty"];

$sorgu = doquery("SELECT COUNT(*) AS wrc FROM WRC_BDW_KAYIT WHERE StrAccountID = '".$acc."'", true);
$kyt=$sorgu["wrc"];

if($loyalty < 2000) {
    $geri = 'You cannot register because you have less than 2000 Loyalty.';
} else {

    if ( $kyt != "0" ) { // kayэtlэysa
        doquery("UPDATE WRC_BDW_KAYIT SET Zone = 0 WHERE StrAccountID = '".$acc."'");
        $geri = '<span style="color:#A2A2F1;" id="kayit">You are already registered.</span>';
    }
    else {
        doquery("INSERT INTO WRC_BDW_KAYIT VALUES ('".$char_id."', '".$acc."', 0, '".$css."', '".$nation."', '".$lwl."')");
        $geri = '<span style="color:green;" id="kayit">Congratulations!<br />You have successfully registered.</span>';
    }

}

基本if语句,您已经获得了数据,并且您知道完全您要检查的内容,问题是什么?