Welcome Guest, Not a member yet? Register   Sign In
Active Record - removing quotes from where()
#1

[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?
#2

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

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




Theme © iAndrew 2016 - Forum software by © MyBB