How can I do this?

Discussion in 'PHP' started by tonyuk, Oct 18, 2007.

  1. #1
    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']) ;


    }
     
    tonyuk, Oct 18, 2007 IP
  2. Lordy

    Lordy Peon

    Messages:
    1,643
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if ($info['stakeback'] == 'Y') {
    
    $user_fee = ($winnings - $fee - $info['samount']) * ($info['spercent'] / 100) ;
    if ($winnings>0)
    $user_fee = ($user_fee + $info['samount']) ;
    
    
    }
    PHP:
    or am i missing something? :p
     
    Lordy, Oct 18, 2007 IP
  3. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Seems right, Lordy :)
     
    tamen, Oct 19, 2007 IP