How to MINUS sum of values from sum of values php and mysql -


am new in php, , have serious question answer, hope me.

i have table on mysql named "payment" following fields

(school_fee  |  fee_setting  |  trans_port  |   trans_setting) 

in fields setting of fields set actual total amount of money student suppose pay appropriate service per 3 month, , student can pay installment, guys want when set may 100000 @ once in fee_setting, , when student come , pay 20000 school_fee amount reducted each time when student pay school_fee . means (fee_setting) reduct total number of school_fee payed student.

i have codes reduct first student , others student results comes negative sign(-), confused don't know problems is.

here codes:

echo $results['sum(fee_setting)'] - $results ['sum(school_fee)']."</td>";    

i think need abs() avoid negative values :

echo abs($results['sum(fee_setting)'] - $results ['sum(school_fee)'])."</td>";    

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -