gotornot Posted September 18, 2009 Share Posted September 18, 2009 Hi I am trying to add float figures together but for some reason its not working with the script below any ideas? $ai = 0; // Round upp all fees add them together while ($feeitem = mysql_fetch_array($cartr)) { $ai2 = $feeitem["fee"]; $ai = $ai + $ai2; } echo $ai; All it does is output the 0 Figures are like 4.65 and 66.50 Any ideas? Link to comment https://forums.phpfreaks.com/topic/174685-add-float-figures/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 18, 2009 Share Posted September 18, 2009 The posted code is dependent on the while() loop executing. Have you checked that the query worked and returned a result resource (use an if(){} statement around the query) and have you checked if there were any rows in that result resource (use mysql_num_rows() )? Link to comment https://forums.phpfreaks.com/topic/174685-add-float-figures/#findComment-920677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.