CodeIgniter Forums
when using where and get with datamapper, it only returns one record even though multiple meet the condition - 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: when using where and get with datamapper, it only returns one record even though multiple meet the condition (/showthread.php?tid=40450)



when using where and get with datamapper, it only returns one record even though multiple meet the condition - El Forum - 04-08-2011

[eluser]johnmerlino[/eluser]
Hey all,

When I do this:

Code:
$category->where('controller',$this->uri->segment(1))->get();

I have multiple records in my categories table where the field called controller has a value that is equal to what's in the current uri segment. So if segment 1 of uri is 'home', and I have multiple records in categories table with a controller value of 'home', I would expect all those records to be part of the returned value from the get call. However, it only returns the first record it finds that matches the where condition.

I looked over this document carefully:

http://stensi.com/datamapper/pages/get.html

But I am stumped how I can return multiple records that meet the where condition when using get.

Thanks for response.


when using where and get with datamapper, it only returns one record even though multiple meet the condition - El Forum - 04-09-2011

[eluser]johnmerlino[/eluser]
Actually I was wrong. It does return all the records.