Hi Ambika,
All of 'fields', 'conditions', 'order' and 'group' arrays must be
inside the same array which is the second parameter of find()
function. Like the following:
$maincategories = $this->MainCategory->find('list', array(
'fields' =>
array(
'main_category_id','main_category','type'
),
'conditions' =>
array(
'MainCategory.type' => ''
),
'order' =>
'MainCategory.main_category ASC',
'group' =>
'MainCategory.type'
);
Ambika Kulkarni wrote:
> Hi all,
>
> i am using the following find() function to get the data in a list. I
> have put the conditions but still its taking all values.
>
> $maincategories = $this->MainCategory->find('list', array(
> 'fields' =>
> array(
>
> 'main_category_id','main_category','type'
> )
> ),
> array(
> 'conditions' =>
> array(
>
> 'MainCategory.type' => ''
> )
> ),
> array(
> 'order' =>
> 'MainCategory.main_category ASC'
> ),
> array(
> 'group' =>
> 'MainCategory.type'
> )
> );
>
> O/P is
> <select id="maincategories" name="data[Campaigns]
> [maincategory_mainCategoryId]">
>
> <option value="11">Wrap & pack exp store</option>
> <option value="10">Groceries & toiletries </option>
> <option value="9">Fruit & vegetables </option>
> <option value="8">Deli </option>
> <option value="7">Perishables </option>
> <option value="6">Fresh meat</option>
> <option value="5">Major household appliances </option>
> <option value="4">Non Foods </option>
> <option value="3">Delicatessen dept.</option>
> <option value="2">Wet fish </option>
> <option value="1">Bakery </option>
> ----------------------------------------------------------------------------------------------------
> <optgroup label="deprecated">
> <option value="25">Petfood</option>
> <option value="24">Wine</option>
> <option value="23">Stationary</option>
> <option value="22">Toys</option>
> <option value="21">Non Foods</option>
> <option value="20">Freezers</option>
> <option value="19">Fridges</option>
> <option value="18">Prepacked Fresh Vegetables</option>
> <option value="17">Prepacked Fresh Fruit</option>
> <option value="16">Groceries</option>
> <option value="15">Household</option>
> <option value="14">Baby Care</option>
> <option value="13">Self Medication</option>
> <option value="12">Toiletries</option>
> </optgroup></select>
> i want the data till the that line.
> Thanks
> Ambika
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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