Wednesday, October 29, 2008

Re: Error with HABTM $__cakeID__$ with only an ID

I solved so:

//how results?
$NumberResults = $this->Person->findCount($SubSQL);
//If the result is 1 I must change the sql code
$PieceOfSql ='{$__cakeID__$}';

if($NumberResults==1) $PieceOfSql = '({$__cakeID__$})';


but It is not so elegant to perform a query so someone can give me a
better solution ?
Thanks!

On 30 Ott, 00:40, Alessio <unideat...@gmail.com> wrote:
> If have only an id in the finderquery i Get the error....SQL Error:
> 1241: Operand should contain 1 column(s).
>
> If I put the pharentesis I can solve, but if I have more ids, I get
> the error..
>
> What the solution...
>
> and `PizzeDolci`.`persona_id` IN
>
>                            ({$__cakeID__$})
>                              )
>                       WHERE 1 = 1
>
> If I remove the pharentesi I get ok with singular results but error
> with multiple results...
>
> I use Cakephp Rc3...
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: