DataMapper is only returning the last part of this query

Posted by Josh K on Stack Overflow See other posts from Stack Overflow or by Josh K
Published on 2010-04-29T02:48:15Z Indexed on 2010/04/29 2:57 UTC
Read the original article Hit count: 432

Filed under:
|
|

So I'm using the following:

    $r = new Record();
    $r->select('ip, count(*) as ipcount');
    $r->group_by('ip');
    $r->order_by('ipcount', 'desc');
    $r->limit(5);

    $r->get();

    foreach($r->all as $record)
    {
        echo($record->ip." ");
        echo($record->ipcount." <br />");
    }

And I only get the last (fifth) record echo'ed out and no ipcount echoed.

Is there a different way to go around this? I'm working on learning DataMapper (hence the questions) and need to figure some of this out. I haven't quite wrapped my head around the whole ORM thing.

© Stack Overflow or respective owner

Related posts about codeigniter

Related posts about datamapper