The (int) in $pdata['PAYED_TOTAL'] = (int) $data['total']; is making my amounts round down to the nearest integer. Should this be (float) or (double)? The column is defined as decimal(8,2)
Your $pdata['PAYED_TOTAL'] will not be decimal or float because you use (int) so your value will be negative or positive integer.
I meant I didn't want it to be rounding (up or down). I just want it to have the correct dollar value. This is code that is in phpLD 2.0 and I've debugged it down to this line of code. I'm just wondering if I should use (float) or (double) or something else instead of (int) to make it work.
number_format() still round the value like number_format(210.73) will be 211 try write your own function like this example $num = 210.73; function no_round($value){ $val = explode('.',$value); echo $val[0]; } no_round($num);
OK...I assumed a link to the page would give a hint on how to use the function. It will not round the number...it will format a float number. $pdata['PAYED_TOTAL'] = number_format($data['total'], 2, '.', ','); echo $pdata['PAYED_TOTAL']; // outputs xxx.yy (formatted to 2 decimal places) PHP: Bobby
thanks. I believe this will do the trick $pdata['PAYED_TOTAL'] = round($data['total'],2); Too bad i can't do an e2e test on this because it's only executed after the paypal successful payment page. Is there a setting to switch paypal to testing mode?