mysql - PHP Calculation from database not calculating correctly. -


i trying run sum numbers taken database. can't seem work.

does have ideas why keep getting 0 instead of percentage? if guide me in right direction.

php:

//sql original goal $goal = "select * login username = '$login'"; $goalquery = mysql_query($goal); $goalarray = mysql_fetch_array($goalquery);  $endgoal = $goalarray['goal'];      //latest weight $latestweightarray = mysql_fetch_array($latestweightq); $currentweight = $latestweightarray['weight'];      //first weight recorded $firstweightarray = mysql_fetch_array($firstweightq); $firstweight = $firstweightarray['weight'];  $percent = "100";  $progress = (($firstweight - $currentweight) / ($firstweight - $endgoal)) * $percent; 

print result:

<?php  echo $progress  ?> 

this gives: 0

rookie error, had updated database twice in 1 day conflicted results somehow, changed 1 of dates in database , solved problem


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -