Welcome Guest, Not a member yet? Register   Sign In
Order by Domain Extension Name
#1

[eluser]ronald_allan_rivera[/eluser]
Quote:$extension = "SUBSTRING_INDEX(domain_name, '.', -1)";
$this->db->order_by($extension, "asc");

It says:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc LIMIT 50' at line 44

But its working when I didn't used the $this->db->order_by Active Record Class
such as this one:
$this->db->query("SELECT * FROM domain ORDER BY SUBSTRING_INDEX(domain_name, '.', -1)");

Anyone please help me. Thanks.
#2

[eluser]ronald_allan_rivera[/eluser]
Since:
$extension = “SUBSTRING_INDEX(domain_name, ‘.’, -1)”; $this->db->order_by($extension, “asc”);

Result to:
SUBSTRING_INDEX(domain_name, `'`.`'`, `-1)`

I edit:
system/database/drivers/mysql/mysql_driver.php

by changing:
var $_escape_char = '`';
to
var $_escape_char = '';




Theme © iAndrew 2016 - Forum software by © MyBB