$condition = array();
if($this->data['Comment']['module_name'] == 'news' && $this->data['Comment']['news'] == 'all')
$condition['Comment.content_type'] = $this->data['Comment']['module_name'];
if($this->data['Comment']['module_name'] == 'opinions' && $this->data['Comment']['opinions'] == 'all')
$condition['Comment.content_type'] = $this->data['Comment']['module_name'];
if($this->data['Comment']['module_name'] == 'classifieds' && $this->data['Comment']['classifieds'] == 'all')
$condition['Comment.content_type'] = $this->data['Comment']['module_name'];
than
use find query
$result = $this->Comment->find('all', array('recursive'=> -1,'fields'=>array('*'),'conditions' => array('Comment.created >' => $fromDate,'Comment.created <' => $toDate, $condition)));
kher hay barri kas k tie lagayi hy? Zafar
ReplyDelete