ya i removed that and it worked

Thanks a lot

On Fri, May 14, 2010 at 3:12 PM, Jeremy Burns <[email protected]> wrote:

> This is caused by your order statement in your hasMany SubCategory...
>
>  'MainCategory.mainCategory ASC',
>>
>
> Try removing it.
>
>
> Jeremy Burns
> [email protected] <[email protected]>
>
>
> On 14 May 2010, at 10:38, Ambika Kulkarni wrote:
>
>
> I changed the file name from maincategory.php to main_category.php
>
> and i put this line of code
>  $this->MainCategory->main_category_id = $_POST['id'];
>  $this->MainCategory->save($this->data);
>
> I am getting this error nw
>
> *Warning* (512): *SQL Error:* 1054: Unknown column 
> 'MainCategory.mainCategory' in 'order clause' 
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *525*]
>
>
>
> On Fri, May 14, 2010 at 1:37 PM, Jeremy Burns <[email protected]> wrote:
>
>> I see several potential problems here, mostly caused by not sticking to
>> conventions.
>>
>> Your model file ought to be called main_category.php
>>
>> If you want to stick to conventions, Id' rename your table's primary key
>> to 'id'. But assuming you won't/can't/don't do this...
>>
>> Why are you using $_POST?
>>
>> It seems as if your form has a field called 'id' that maps to your
>> model/table field main_category_id...baffling.
>>
>> Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
>> ...to this: $this->MainCategory->main_category_id = $_POST['id'];
>>
>> Jeremy Burns
>> [email protected]
>>
>>
>> On 14 May 2010, at 08:43, Ambika Kulkarni wrote:
>>
>> > Hi folks,
>> >
>> > I have a tbl called main_categories
>> > tbl schema is
>> > main_category_id , main_category,type,active,deleted
>> >
>> > model data maincategory.php
>> > class MainCategory extends AppModel {
>> >    var $name = 'MainCategory';
>> >    var $primaryKey = 'main_category_id';
>> >    var $hasMany = array(
>> >                   'SubCategory' => array(
>> >                                    'className' => 'SubCategory',
>> >                                    'foreignKey' =>
>> > 'main_category_id',
>> >                                    'dependent' => false,
>> >                                    'conditions' => '',
>> >                                    'fields' => '',
>> >                                    'order' =>
>> > 'MainCategory.mainCategory ASC',
>> >                                    'limit' => '',
>> >                                    'offset' => '',
>> >                                    'exclusive' => '',
>> >                                    'finderQuery' => '',
>> >                                    'counterQuery' => ''),);
>> >
>> > }
>> >
>> > in the main_categories_controller.php
>> > if ( $_POST['a'] == "Update") {
>> >
>> >                //$this->MainCategory->recursive = 1;
>> >
>> >                $this->MainCategory->mainCategoryId = $_POST['id'];
>> >
>> >                $this->MainCategory->save($this->data);
>> >
>> >            }
>> > Its not updating the record
>> > $this->MainCategory->id = $_POST['id'];
>> > $this->MainCategory->main_category_id = $_POST['id'];
>> >
>> > not working
>> > Please help me
>> >
>> > 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]<cake-php%[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]<cake-php%[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
>
>
>  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]<cake-php%[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

Reply via email to