switch($kk)
{
case 1:
$flag=true;
if ($month)
{
echo"<pre>";
echo $select->where('start_date between "' . $year . '-' . $month . '-01" and "' . $year . '-' . $month . '-' . $this->daysInMonth($month, $year).'" and end_date between "' . $year . '-' . $month . '-01" and "' . $year . '-' . $month . '-' . $this->daysInMonth($month, $year).'"' );
}
$select->order('start_date ASC');
break;
case 2:
$flag=true;
if ($month)
{
echo $select->where('start_date < "' . $year . '-' . $month . '-01" and end_date between "' . $year . '-' . $month . '-01" and "' . $year . '-' . $month . '-' . $this->daysInMonth($month, $year).'"' );
}
$select->order('start_date ASC');
break;
case 3:
$flag=true;
if ($month) {
echo $select->where('start_date between "' . $year . '-' . $month . '-01" and "' . $year . '-' . $month . '-' . $this->daysInMonth($month, $year).'" and end_date > "' . $year . '-' . $month . '-'.$this->daysInMonth($month, $year).'"' );
}
$select->order('start_date ASC');
break;
case 4:
$flag=true;
if ($month) {
echo $select->where('start_date < "' . $year . '-' . $month . '-01" and end_date > "' . $year . '-' . $month . '-'.$this->daysInMonth($month, $year).'"' );
}
$select->order('start_date ASC');
break;
}
$select->order('start_date ASC');
This statement sorts element. But it sorts according to result of query cases. I need one sort query to sort all cases result. How should I do?