Nope....no go

I have 'Post' => array('fields' =>array('Post.title' , 'substr(description ,
0 , 50)' )

Tried: 
'Post' => array('fields' =>array('Post.title' , 'substr(Post.description , 0
, 50)' )

'Post' => array('fields' =>array('Post.title' , substr('Post.description' ,
0 , 50) )

The array spits out

[0] => Array
                                        (
                                            [substr(description , 0 , 50)]
=> 
                                        )

-----Original Message-----
From: Rick [mailto:[email protected]] 
Sent: June-07-09 10:21 AM
To: CakePHP
Subject: Re: Limit characters?


In your select you can do something like this:

[code]
$this->Model->find('xxx', array(
  fields => 'substr(description, 0, 50)', ...
[/code]

On Jun 6, 1:20 pm, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> Can cake limit the return on characters in a query?
>
> I have in view
>
> <?php echo substr($additional_posts['description'],0,50);?>
>
> to display the first 50 characters in the post descriptions to give a 
> brief description to a user...but rather than pulling the whole 
> description in the find then displaying limited characters, can i 
> limit the description to 50 characters in the find query?
>
> Thanks,
>
> Dave


--~--~---------~--~----~------------~-------~--~----~
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