funbinod Posted April 14, 2014 Share Posted April 14, 2014 (edited) i tried this $TotalSales = mysql_fetch_array($sales);$TotalReceipts = mysql_fetch_array($receipt);$TotalBalance = $TotalSales - $TotalReceipts;echo $TotalBalance; what is the problem???? Edited April 14, 2014 by funbinod Link to comment Share on other sites More sharing options...
davej Posted April 14, 2014 Share Posted April 14, 2014 Did you test this? echo "SELECT SUM(amt) AS TotalSales FROM sales where cid = '$cid'"; Link to comment Share on other sites More sharing options...
funbinod Posted April 14, 2014 Author Share Posted April 14, 2014 Did you test this? echo "SELECT SUM(amt) AS TotalSales FROM sales where cid = '$cid'"; yes i tried that. both '$TotalSales' & '$TotalReceipt' give the perfect value. but while using math between them is not working.. Link to comment Share on other sites More sharing options...
funbinod Posted April 14, 2014 Author Share Posted April 14, 2014 wow! i made it done $balance = $TotalOb['sum(cob)'] + $TotalSales['sum(amt)'] - $TotalReceipt['sum(amt)']; Link to comment Share on other sites More sharing options...
funbinod Posted April 14, 2014 Author Share Posted April 14, 2014 besides this, can u guide me how to insert amount to the database with 00,000.00 format? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 14, 2014 Share Posted April 14, 2014 Numbers in the database should not be saved with any format, you should use integer or float columns. You format the number when you get it out of the database and display it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now