足球博彩游戏 - 积分计算

时间:2016-05-16 10:14:37

标签: php html if-statement

我正在用PHP / MSQL创建一个足球博彩游戏,现在我试图用if语句来计算得分系统。

每个团队都会保存这样的投注:

Team 1: Bayern Munich  
Team 2: Borussia Dortmund

Bet_Team1: 4  
Bet_Team2: 1

实际结果:
拜仁慕尼黑 5:2 Borussia Dortmund

像这样保存:

Result_Team1: 5
Result_Team2: 2

我用if语句尝试了这个:

// Completely right draw:    
if($Bet_Team1 === $Result_Team1 && $Bet_Team2 == $Result_Team2){
    $points = $points+6; }

它运作良好,但我不知道如何计算得分,如果用户在拜仁慕尼黑和多特蒙德的上例中投注正确的胜利者队伍。

1 个答案:

答案 0 :(得分:1)

如何让你入门

// Completely right draw:    
if($Bet_Team1 === $Result_Team1 && $Bet_Team2 == $Result_Team2){
    $points = $points+6; 
}
// they guessed the winning team but wrong score
else if ( ($Result_Team1 > $Result_Team2 && $Bet_Team1 > $Bet_Team2) ||
          ($Result_Team2 > $Result_Team1 && $Bet_Team2 > $Bet_Team1)
        ) 
{
    $points += ?  // how many points do you allocate to this situation
}
相关问题