cuzzmunger Posted June 1, 2011 Share Posted June 1, 2011 Hi freaks, Yes im a noob... I have some data in a db that im echoing out, but the last row wont multiply? The rest works great... I have tried having the data as the following: 1.12 or 0.12 & I have tried having it as a var. Do I need to have a % in there somewhere? Im adding up all the data then I want to multiply by 12% (*$row['markup']) <?php echo $row['Stock1']*$row['qty']+$row['cutting']+$row['production']+$row['additional']+$row['pluscover']+$row['selfcover']*$row['markup'];?> any help would be appreciated. cuzzmunger. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted June 1, 2011 Share Posted June 1, 2011 What are the values that should be in those variables, and what is the result you're expecting, versus the result you're getting? Quote Link to comment Share on other sites More sharing options...
cuzzmunger Posted June 1, 2011 Author Share Posted June 1, 2011 Thanks for the reply, the maths below: 0.50*100+30+30+5+5+5*12%=140 is the same as Stock1*qty+cutting+production+additional+pluscover+selfcover*markup= total price the result i get is 125 so its not doing the last multiply (*$row['markup']) I just want to add it all up then *12% <?php echo $row['Stock1']*$row['qty']+$row['cutting']+$row['production']+$row['additional']+$row['pluscover']+$row['selfcover']*$row['markup'];?> I only tried the var like this instead of taking it from the database $markup_var = 1.12; then I added ...........$row['selfcover']*$markup_var cheers Quote Link to comment Share on other sites More sharing options...
xyph Posted June 1, 2011 Share Posted June 1, 2011 You want (0.50*100+30+30+5+5+5)*1.12 Quote Link to comment Share on other sites More sharing options...
cuzzmunger Posted June 1, 2011 Author Share Posted June 1, 2011 Tested and working Thank you so much. I knew I would get help here! <?php echo ($row['Stock1']*$row['qty']+$row['cutting']+$row['production']+$row['additional']+$row['pluscover']+$row['selfcover'])*$row['markup'];?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.