How to get day of month to calculate total sales in PHP and Mysqli? -


here project want accomplish. input data user , automatically creating date modified.

input , list of result on loop fine. want calculation total sales month , year.

database column style example: model_name, sold_date, sold, stock_left... date using now() on php inserting code, result stored on database 2015-04-06.

each sale have own created date. example:

name  sold     date  item1  3      2015-04-06 item2  4      2015-04-06 item1  4      2015-04-07 

i want grab day of date 2015-04-06 , sum total sales each item. , show monthly sale yearly sale.

i not sure if think if in right way or not.

have no clue that.

i search on internet, no luck purpose. thinking that:

select year(sold_date) 'year',         month(sold_date) 'month'  table  condition = 'condition'; 

but show result of loop, need

$mysqli->query("select *                  item                  order sold_date desc                   limit $start,$per_page"); 

those 2 sql command seems cannot combine or don't know how combine them. or after combining them, how sum totals. final sales table this:

name   month  total item1 04(apr) 7 

if i'm not mistaken, can use day(<date>), month(<date>) or year(<date>) coorisponding day, month , year date.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -