PDA

View Full Version : Formulas and Summing and Dividing in PHP MySQL


cocoonfx
08-12-2007, 03:43 PM
I have decided a create a page as i am on a health kick at the moment, to list all the foods i am eating and there values like calories etc....

I have built a table in MySQL and i have created a php page to pull the data (thanks to the tutorial from DJ (i think it was his)).

I want to have another page where i enter in say a Banana it then grabs the data and then i want to divide a value against 2500. This part is where i get stuck on.

Can anyone point me in the right directions as i can't think how to do this.

davidj
08-12-2007, 11:12 PM
$value = $row['db_value'] /\ 2500;

echo $value ;



db_value is numeric of course and a db array key

cocoonfx
08-13-2007, 06:52 PM
Thanks DJ that simple..... i will have a play.