On Sep 3, 6:38 pm, Charlie van de Kerkhof <[EMAIL PROTECTED]>
wrote:
SELECT id,title,url, 'review' = $review AS ...
> Thnx Franck06l, but then it the SQL thinks it is a field in the
> database which it is not.
> I want to have the '$filter' as a field VALUE in every item in the
> result array, so I can use it in my template.
>
> I also tried:
> $sQuery = "SELECT id,title,url,CONCAT('$filter') AS
> filter,modified ".
> "FROM $filter AS $filter ".
> "WHERE status=1 AND $field IN ($ids) ".
> "ORDER BY modified DESC";
>
> but no luck.
>
> On Sep 3, 6:31 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Maybe removing the quote around '$filter' (in the SELECT fields) will
> > avoid this.
>
> > On Sep 3, 6:17 pm, Charlie van de Kerkhof <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hi,
>
> > > In my model I do this:
> > > $filter = 'reviews';
> > > $field = 'artist_id';
> > > $ids = '23,46';
> > > $sQuery = "SELECT id,title,url,'$filter',modified ".
> > > "FROM $filter AS $filter
> > > ".
> > > "WHERE status=1 AND
> > > $field IN ($ids) ".
> > > "ORDER BY modified DESC";
> > > $res = $this->query($sQuery);
> > > pr($res);
>
> > > And the output of the pr() function is this:
> > > Array
> > > (
> > > [0] => Array
> > > (
> > > [reviews] => Array
> > > (
> > > [id] => 1
> > > [title] => Title 1e review
> > > [url] =>http://charlie.vdkerkhof.com/2007/02/24/bijna/
> > > [modified] => 2007-08-23 16:48:34
> > > )
>
> > > [0] => Array
> > > (
> > > [reviews] => reviews
> > > )
>
> > > )
>
> > > [1] => Array
> > > (
> > > [reviews] => Array
> > > (
> > > [id] => 3
> > > [title] => Review 2
> > > [url] =>http://charlie.vdkerkhof.com/2007/02/24/bijna/
> > > [modified] => 2007-08-23 16:48:34
> > > )
>
> > > [0] => Array
> > > (
> > > [reviews] => reviews
> > > )
>
> > > )
>
> > > );
>
> > > Why does my field '$filter' is pout in a different array then the rest
> > > of the query?
> > > anyone?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---