You could try to give an alias to the count(*) statement. For example

$sql = 'select count(*) as cnt, games.id, games.name [the rest of the
query]';

Maybe Cake is not able to determine the column's name ("count(*)") ?

On 10 Lis, 22:36, M <[EMAIL PROTECTED]> wrote:
> Hello, I would like to display how many votes a game received today.
>
> In the model game i write:
>
>         $sql = 'select count( * ) , games . id , games . name from games ,
> votes '
>         . ' where games . id = votes . game_id '
>         . ' and date( votes . timestamp ) = curdate( ) '
>         . ' group by games . id , games . name LIMIT 0, 30 ';
>
> $data = $this->Game->execute( $sql );
>
> if i print $data i get the following array, in which i can't find the
> count anywhere.
> What am I doing wrong, and anyone knows if there is an easiest way to
> do it?
>
> Array
> (
>     [0] => Array
>         (
>             [Game] => Array
>                 (
>                     [id] => 1
>                     [name] => Evolution Sphere
>                 )
>
>         )
>
>     [1] => Array
>         (
>             [Game] => Array
>                 (
>                     [id] => 2
>                     [name] => Blacksword RPG
>                 )
>
>         )
>
> )


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to