You shouldn't be using the Query method unless you are doing very very
custom queries. Which your not.

At the moment you have the overhead of CakePHP, but your not actually
using the framework.

I think you should read through the entire CakeBook (Again if you've
already done so) and concentrate on the models section, all your
answers are right there.

On Aug 7, 11:15 am, albe <[email protected]> wrote:
> I have found a solution in this way:
>
> $post['Post']['haswarnings'] = count($this->Warning->query("SELECT  *
> FROM `db`.`warnings` WHERE `post_id` ='".$post_id."'"));
>
> Thank you, anyhow!
>
> On 7 Ago, 01:32, albe <[email protected]> wrote:
>
> > Hi everybody!
> > maybe my problem is banal but I really don't know how to solve it:
>
> > I wrote a query in a controller and put the result in a variable, in
> > this way:
>
> > $variable['Model']['field'] = ($this->Model2->query("SELECT COUNT
> > ( * )...");
>
> > The result of the query is something like this:
>
> > Array
> > (
> >     [0] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [COUNT( * )] => 1
> >                 )
>
> >         )
>
> > )
>
> > Since I have to use this result in the relative view in order to make
> > comparisons (if $variable.Model.field > 0) I need the PURE NUMBER,
> > cleaned by the structure posted above.
> > Otherwise the comparisons wouldn't be correct!
> > Thank you in advance...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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