Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't a new table column show up in the query results in CakePHP?

Tags:

mysql

cakephp

I have added a new column to my table Attributes which already has (id , form_id(foreign key),type,label,size,sequence no,instr) where instr is the new column i have added.

My application is in CakePHP and MySQL.

I have used the following code to insert into the table Attributes But the field instr alone not inserted.

function saveFieldname($data)//from untitledfieldname
{   
    $this->data['Attribute']['form_id'] = $this->find(  'all', array(
                                                        'fields' => array('Form.id'),
                                                        'order' => 'Form.id DESC'
                                                     ));

    $this->data['Attribute']['form_id'] = $this->data['Attribute']['form_id'][0]['Form']['id'];

    $this->data['Attribute']['label'] = 'Label';
    $this->data['Attribute']['size'] ='50';
    $this->data['Attribute']['instr'] ='Fill';

    $this->data['Attribute']['type'] = $data['Attribute']['type'];
    $this->data['Attribute']['sequence_no'] = $data['Attribute']['sequence_no'];

    $this->Attribute->save($this->data);
}

Please suggest me..

like image 542
useranon Avatar asked Jun 16 '09 09:06

useranon


1 Answers

The information about the structure of your table is probably cached. Remove the content of "app/tmp/cache/models" and try it again.

like image 101
dhofstet Avatar answered Sep 27 '22 19:09

dhofstet