-2
Hello, how could I do meta box calculation with PHP? I have a query in which returns all entries of the current month and then the sum.
Target: 200000.00 Total obtained so far: 15000.00
How could I get the completed percentage?
-2
Hello, how could I do meta box calculation with PHP? I have a query in which returns all entries of the current month and then the sum.
Target: 200000.00 Total obtained so far: 15000.00
How could I get the completed percentage?
0
There is no secret, you will store the return of your query in a variable
$total = resultado_da_query;
Divide by goal and multiply by 100.
$meta = 200000;
$porcentagemDoMes = ($total / $meta) * 100
;
If you want to display the result can do:
echo $porcentagemDoMes . "%";
Or you can incapsular this into a function and put the return of function:
return $porcentagemDoMes . "%"
;
Thank you very much!!!!
Browser other questions tagged php calculus
You are not signed in. Login or sign up in order to post.
pctConcluded = Totalobtained / Meta * 100
– Tony
Thanks, haha, that’s right.
– Daniel Lima