It's difficult to say without seeing your code. And I think you'll
find that using debug() or even die() to view the structure of Cake's
data will be helpful. Your concern about getting the "PURE NUMBER" is
misplaced. Once you understand the structure of the data, it's a
simple matter to specify precisely what part of the array to get.

On Sun, Aug 16, 2009 at 11:06 AM, albe<[email protected]> wrote:
>
> I'd like to use Cake as Cake. The problem is that the find method
> doesn't work for me and I've got no idea why this happens!
> When I use it and I try to print the results I get errors of this
> kind:
>
> Notice: Undefined offset: 0 in C:\Program Files\...\model\datasources
> \dbo_source.php on line 1283
> Notice: Undefined offset: 0 in C:\Program Files\...\model\datasources
> \dbo_source.php on line 1285
>
> Do you have any clue?
>
> On 8 Ago, 09:59, Walther <[email protected]> wrote:
>> 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