anyone correct this query according to ZF.i have a situation where user select differet parameters and on the base of that make my query
$user = new Zend_Session_Namespace('user');
$phone_service_id = $user->phone_service_id;
$start_date = $this->_getParam('start_date'); //02/07/2012
$end_date = $this->_getParam('end_date'); //02/21/2012
$option_call_log = $this->_getParam('option_call_log'); //COLUMN NAME
$option_call_log_asc_desc = $this->_getParam('option_call_log_asc_desc'); //ASC/DESC
i think i have a syntax error in query ,see it here
$select = $DB->select()
->from('CALL_LOG', array('caller_name','call_number','call_start_time','call_duration','call_direction'))
->where('phone_service_id = ?', $phone_service_id)
->where(DATE_FORMAT(date_created, '%m/%d/%Y') BETWEEN $start_date AND $end_date)
->order($option_call_log $option_call_log_asc_desc)
->limit(0,9);
whats wrong with this ??
->where(DATE_FORMAT(date_created, '%m/%d/%Y') BETWEEN $start_date AND $end_date)? This should throw a PHP syntax error long before it even gets to querying the db. Shouldn't it be something like->where("DATE_FORMAT(date_created, '%m/%d/%Y') BETWEEN $start_date AND $end_date")? (note inserted double-quotes)echo $selectand get what query you have found and run it on mysql.->order()clause, too.