i'm getting 2 dates php form in dd-mm-yyyy format. (say 01/06/2013 , 30/06/2013) i'm using following code display datewise result among date range given above, it's not working me dates stored in db in unix timestamp format(transaction_date bigint(12)
). how should display datewise results then? can me in resolving issue?
if($form_data['from_date']!='' && $form_data['to_date']!='') { $from_time = explode("/", $form_data['from_date']); $to_time = explode("/", $form_data['to_date']); $start_date = mktime( 0,0,0,$from_time[1],$from_time[0],$from_time[2] ) ; $end_date = mktime( 23,59,59,$to_time[1],$to_time[0],$to_time[2] ) ; $sql =" select count(*) `total count`, sum(transaction_status = 'success') `success`, "; $sql .=" sum(transaction_status = 'inprocess') `inprocess`, sum(transaction_status = 'fail') `fail`, "; $sql .=" sum(transaction_status = 'cancelled') `cancelled` user_transaction "; $sql .=" transaction_date >= '".$start_date."' , transaction_date <= '".$end_date."' group transaction_date "; $this->mdb->query( $sql); $queryresult = $this->mdb->fetcharray(); }
thanks in advance.
use from_unixtime(transaction_date)
date type. info
Comments
Post a Comment