need some help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sadimr9
Forum Newbie
Posts: 2
Joined: Mon Dec 22, 2008 1:31 am

need some help

Post by sadimr9 »

Hello I'm new on php.

I've developed an e-commerce script by my self. but I've some problem on counting total value of my multiple rows. I'm explaining here...

cart.php

item name ................| qyt |....price |.... total |
----------------------------------------------------------------
some item .................. 4 ...... $12.00 .... $48.00
some item .................. 3 ...... $10.00 .... $30.00
some item .................. 1 ...... $43.20 .... $43.20
----------------------------------------------------------------
........................................ Sub Total : $00.00 *
..............................................Total : $00.00 *


I've done with (do while loop) to show the record from mysql, but I can't show the total amount on sub total...

I know it's very little code, but this time my brain failed to find that, so can any one help me to solve that issue.

best regards
Sadi Chowdhury
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: need some help

Post by pcoder »

Have you tried any technique to show the sub total?
sadimr9
Forum Newbie
Posts: 2
Joined: Mon Dec 22, 2008 1:31 am

Re: need some help

Post by sadimr9 »

Hello dear,

I've tried to show to the sub total value with [ mysql_query="select * SUM(price) from table" ]

but it show me more digit. like $23.23'123434534

but I need $45.34 as well.

best regards
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: need some help

Post by pcoder »

To get the rounded value you can use round on PHP.
Cheers
Post Reply