I have a query which gives me perfect results. But I need to send the mysql errors (if any) to UI. So I deliberately change column name to blah_text.
$qID = 13
$this->db->select('id AS optionID, blah_text AS option, is_correct AS isCorrect');
$oQuery = $this->db->get_where('xq_options', array('question_id' => $qID));
if($oQuery){
$qnaArray['options'] = $oQuery->result_array();
}
else{
//$qnaArray['error'] = $this->db->_error_message();
echo "Error: " . $this->db->_error_message();
}
All the get is Error:
I tried using native mysqli function mysqli_error($oQuery); but same O/P
Note: I have set 'db_debug' => FALSE in database config files. If I set it to TRUE, i do get the CI error message
Error Number: 1054 Unknown column 'blah_text' in 'field list' SELECT id AS optionID, blah_text AS option, is_correct AS isCorrect
How do I capture sql errors in a variable and send it to UI like $qnaArray['error']
EDIT: 'db_debug' is currently set to FALSE. I want the error message to be set in a variable. Not echoed on the screen.
'db_debug'=> TRUE. What is the problem?$qnaArray['error'] = strip_tags($this->db->_error_message());.