No the function. SUBSTR(Post.description, 0, 50)
On Jun 7, 1:21 pm, "Dave Maharaj :: WidePixels.com" <d...@widepixels.com> wrote: > Still same thing.... > > 'Post' => array('fields' =>array('Post.title' , 'Post.created' , > 'substr(Description, 0, 50)' , 'Post.key'), > 'limit' => 5, > )) > > Returns this query: > SELECT `Post`.`title`, `Post`.`created`, substr(Post.Description, 0, 50), > `Post`.`key`, `Post`.`user_id`, `Post`.`id` FROM `posts` AS `Post` WHERE > `Post`.`user_id` = (6) LIMIT 5 > > [0] => Array > ( > [substr(Post.Description, 0, 50)] => > ) > > -----Original Message----- > From: Miles J [mailto:mileswjohn...@gmail.com] > Sent: June-07-09 5:34 PM > To: CakePHP > Subject: Re: Limit characters? > > It has to be capitalized. > > On Jun 7, 11:03 am, "Dave Maharaj :: WidePixels.com" > <d...@widepixels.com> wrote: > > 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:will...@gmail.com] > > 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" > > <d...@widepixels.com> 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---