MyBB Community Forums

Full Version: Sub Conditional
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In the code below in bold I only want to perform this calculation if $winnings > 0. How would I code this?

if ($info['stakeback'] == 'Y') {

$user_fee = ($winnings - $fee - $info['samount']) * ($info['spercent'] / 100) ;

$user_fee = ($user_fee + $info['samount']) ;


}
if ($info['stakeback'] == 'Y')
{
    $user_fee = ($winnings - $fee - $info['samount']) * ($info['spercent'] / 100) ;

    if ($winnings < 0)
    {
        $user_fee = ($user_fee + $info['samount']) ;
    }

}
would be one way. Not the most efficient, but I'm just working with your code here.