well, since the experts aren't talking why not use the long cut... $result = mysql_query(Select * from TABLE where Date is between "$date1" to "$date2"); //sql is probably buggy not sure howto use between while( $row = mysql_fetch_assoc(result)) { print $date_found; $total = $total + $row["total"]; } print "Total:".$total; here's long shot ...took me 20 minutes to write...goto for class now.good luck --- In php-objects@xxxxxxxxxxxxxxx, ikhnaton2 <ikhnaton2@xxxx> wrote: > I don't know what database backend u use but if it's Oracle, u can do this by, > > select sum(price), sum(stock), to_date(date, 'dd/mm/yyyy') > from product_stock > group by to_date(date,'dd/mm/yyyy') > > However, if u use MySQL, I don't know what's the alternative of > TO_DATE function in MySQL. You can search for it and do the same SQL > statement in MySQL. > > I wish this could benefit u by anyway. > > > > Date: Sat, 28 May 2005 06:47:50 -0700 (PDT) > > From: agus susilo <deffleo@xxxx> > > > > i have problem with script php.i make shop program > > with php, but i find problem when i wanna to view > > product group by date.i want to view product, each > > date have total in the bottom of items.for example > > like this > > +--+----------------+------+------+-------------+ > > |ID|Name of Product |Price |Stocks|Date | > > +--+----------------+------+------+-------------+ > > |1 |USB Mouse |3 US$ |3 |05/28/05 | > > |2 |Keyboard |4 US$ |10 |05/28/05 | > > +--+----------------+------+------+-------------+ > > | |7 US$ |13 | | > > +--+----------------+------+------+-------------+ > > |3 |Flash Disk |25US$ |4 |05/29/05 | > > +--+----------------+------+------+-------------+ > > 25US$ 4 > > > > > > each date have total self.i hope u understand what i > > mean.thank you so much and i am sorry if my english is > > bad. > > -- > Webpage: http://www.ikhnaton2.tk/ > Blog: http://it-experience.blogspot.com/ PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/