Jump to content

Negative not working?


drisate

Recommended Posts

Hi guys. I am trying to build a script that updates the users account balance after a paiement is made but for some reason it's not working well.

 

Current user balance: -53.88 ($amt)

Paiement is 53.88 ($alertpay_data[16])

The balance should be 0 ... ($amts)

 

-53.88+53.88=0

 

But for some reason is says the new balance is 53.88 with out any - in front so i asum it became a positive value ... Weird. I don't get it.

 

$UPDATE = mysql_query("UPDATE atransaction SET end_date='$end_date', amt_paid='$alertpay_data[16]', end_stamp='$end_stamp', status='2', alertpay='$alertpay' where id_membre = '$transaction_data[1]' and id='$transaction_data[$theloop]'");
$amt = sprintf("%01.2f", @current(@mysql_fetch_assoc(@mysql_query("SELECT amt_bank FROM customers_info where customers_info_id='$transaction_data[1]'"))));
$amts= sprintf("%01.2f", ($amt)+$alertpay_data[16]);
$UPDATE = mysql_query("UPDATE customers_info SET amt_bank='$amts' where customers_info_id = '$transaction_data[1]'");

Link to comment
https://forums.phpfreaks.com/topic/119165-negative-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.