CodeIgniter Forums
Active Record - removing quotes from where() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Active Record - removing quotes from where() (/showthread.php?tid=32495)



Active Record - removing quotes from where() - El Forum - 07-25-2010

[eluser]Prophet[/eluser]
Hi all. When I want to do something like this using Active Record:
Code:
SELECT *
FROM `users`, `groups`
WHERE `users`.`group_id` = `groups`.`id`

I expect to be able to do this:
Code:
$query = $this->db->select('*')
    ->from('users, groups')
    ->where('users.group_id', 'groups.id')
    ->get();

However, this produces the following query:
Code:
SELECT *
FROM `users`, `groups`
WHERE `users`.`group_id` = 'groups.id'

I am able to prevent this from happening by setting the third parameter of where() to FALSE (which removes the backticks and quotes), however I would rather keep the backticks there. Is there a way to remove the quotes around the second parameter of where() without removing the backticks?


Active Record - removing quotes from where() - El Forum - 07-25-2010

[eluser]cahva[/eluser]
Use the FALSE as third parameter and add the backticks if you think they are important? Smile


Active Record - removing quotes from where() - El Forum - 07-26-2010

[eluser]Phil Sturgeon[/eluser]
The backticks really aren't important. You don't need ->select('*') either.