gkc:

If I understood your question correctly what you want is something like this???

$aResult = $this->Model->find('all', array('limit' => 200));

or something along those lines, specifying the field that you want, or
the ones that you would like excluded.

Regards,

Alfredo


On Wed, Feb 4, 2009 at 6:18 PM, gkc <gerardkco...@gmail.com> wrote:
>
> Can anybody help with this?
>
> On Feb 4, 1:27 pm, gkc <gerardkco...@gmail.com> wrote:
>> This is according to the documentation:
>>
>> =====================================
>> If you need to use SQL operators such as in (MySQL) DISTINCT, MAX,
>> MIN, etc... you can specify it as part of the 'fields' key, as such:
>>     $this->Product->find('all', array('fields'=>'DISTINCT
>> (Product.name) AS product_name'));
>>
>> =====================================
>>
>> But that is not working for me.  I would rather limit in the query
>> than passing it to PHP.  If thats my only option, then I will oblige
>> but there has got to be a way to do this.
>>
>> On Feb 4, 11:47 am, czarcrab <czarc...@gmail.com> wrote:
>>
>> > 2 ways about it.
>>
>> > One, switch on debug=1 (atleast) in core.php.  This should give you
>> > the query and some indication on how to fix it.
>>
>> > Two, if the idea is to limit the amount of characters displayed in the
>> > view, then handle it in the index.ctp like this
>>
>> > echo "<td>".(strlen($data['records'][$i][$field["table"]][$field
>> > ["title"]]) > 25?substr($data['records'][$i][$field["table"]][$field
>> > ["title"]],0,22)."...":$data['records'][$i][$field["table"]][$field
>> > ["title"]] )."&nbsp;</td>";
>>
>> > On Feb 4, 12:28 pm, gkc <gerardkco...@gmail.com> wrote:
>>
>> > > I need to limit the amount of characters returned on a field.
>>
>> > > I have tried using 'fields'=>array('LEFT(field,200) AS \'field\'') but
>> > > I get an undefined index: field error when I do this.
>>
>> > > Any suggestions would be greatly appreciated.
> >
>

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

Reply via email to