Welcome Guest, Not a member yet? Register   Sign In
Trouble with Active Record Class where_not_in()
#1

[eluser]Unknown[/eluser]
I'm trying to select a set of records from my database that exclude a particular set. I was stoked to find where_not_in() exists, but it seems to be generating some strange syntax and I'm not sure how to resolve it...

Here is the code:
Code:
$related_criteria = new Query;
$related_criteria
->where('rating >=', '4')
->like('keywords', 'california');
$related_criteria
->where_not_in('clubgroup_id', $data['clubgroups'])
->where('daily_budget_reached <>', 1)
->where('active =', 1)
->where('active_company =', 1);
And here is the SQL that's getting generated:

[code]SELECT `listings`.* FROM `listings` WHERE (`rating` >= '4' AND `keywords` LIKE '
#2

[eluser]Aken[/eluser]
Well considering it's not standard CI functionality to load queries by instantiating a class in that way, I can only assume it's something with your code. I did a very basic test that included all of your where/like/etc. modifiers (and used range() for the 'clubgroups' IDs) and it generated a query just fine.
#3

[eluser]Unknown[/eluser]
Wow. Thanks, that's a helpful hint... would mind helping me understand what about how I've done that is non-standard? It's worked for me until now, but I'd prefer to do things the right way if I knew how.
#4

[eluser]Aken[/eluser]
Whole user guide full of how to use CodeIgniter... http://ellislab.com/codeigniter/user-gui...index.html




Theme © iAndrew 2016 - Forum software by © MyBB