UP
On 16 Ago, 11:55, albe <[email protected]> wrote:
> Hello everybody,
> I have this query:
>
> $_this_id = $this->Post->query("SELECT DISTINCT `forum_id` FROM
> `db`.`posts` WHERE `discussion_id` ='".$id."'");
>
> That gives me a result like this:
>
> Array
> (
> [0] => Array
> (
> [posts] => Array
> (
> [forum_id] => 1
> )
>
> )
>
> )
>
> But I want to obtain only the numeric result! (1)
>
> I've tried to use the find function in this way:
>
> $_this_id = $this->Post->find('first', array('conditions' =>array
> ('Post.discussion_id'=>$id), 'fields'=>array('Post.forum_id')));
>
> But when I try to print the result:
>
> pr($_this_id);
>
> I get a lot of errors of this kind:
>
> Notice: Undefined offset: 0 in C:\...\model\datasources\dbo_source.php
> on line 1283
>
> What is the reason?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---