I want to fetch data
$form
to $to
variable which has date stored in it. so basicaly I want to fetch the data date wise
.
Here is my code:
if ($_POST['data'] == 'paymentanalyticdata') {
$criteria = new CDbCriteria;
$criteria->join = 'LEFT OUTER JOIN payment_integration AS PI ON PI.name = t.payment_method AND PI.store_id=' . Yii::app()->session['store_id'];
$criteria->select = 'PI.title as payment_method,sum(t.total) as total';
$criteria->group = 'PI.title';
$criteria->condition = 't.store_id=\'' . Yii::app()->session['store_id'] . '\'';
$from = isset($_POST['from']) ? $_POST['from'] : '';
$to = isset($_POST['to']) ? $_POST['to'] : '';
if ($from != '' && $to != '') {
$criteria->condition .= 't.entrydate';
}
$list = Order::model()->findAll($criteria);
$categorylist = [];
foreach ($list as $row) {
$categorylist[] = array('PI' => $row->payment_method, 'total' => $row->total);
}
$seocount['paymentanalyticdata'] = $categorylist;
echo json_encode($seocount);
I want to write condition in
$criteria->condition .='????';What code should be write in this condition.