Weird backticks behaviour in Active Record in CodeIgniter 2.0.3
Use this line before your query:
$this->db->_protect_identifiers=false;
This will stop adding backticks to the built query.
The solution is very simple: In the database configuration file (./application/config/database.php) add a new element to array with default settings.
$db['default']['_protect_identifiers']= FALSE;
This solution is working for me and more elegant and professional.
All other answers are really old, this one works with CI 2.1.4
// set this to false so that _protect_identifiers skips escaping:$this->db->_protect_identifiers = FALSE;// your order_by line:$this -> db -> order_by('FIELD ( products.country_id, 2, 0, 1 )');// important to set this back to TRUE or ALL of your queries from now on will be non-escaped:$this->db->_protect_identifiers = TRUE;