<?php class Models_update extends CI_Model{ public function __construct(){ parent::__construct(); $this->load->database(); } function update_data($value){ $this->db->limit(1); $this->db->update('profile',$value,array('name'=>'久保')); $this->output->enable_profiler(TRUE); } function add_col(){ $this->load->dbforge(); $this->dbforge->add_field('id'); } } ?>
<?php class Controller_update extends CI_controller{ public function __construct(){ parent::__construct(); $this->load->database(); } function index(){ $value=array( 'name'=>'山田', 'gender'=>'男', 'birthday'=>'2017-03-01', ); $this->load->model('models_update'); $this->models_update->update_data($value); $this->models_update->add_col(); } } ?>
今あるname,gender,birthdayのフィールドに新たにidフィールドを追加したいと思い、
dbforgeを追加してみたのですが、エラーは出ないんですが、idが追加されません。
何がいけないのでしょうか。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/11 06:30
2017/03/11 06:46 編集
2017/03/11 07:04
2017/03/11 09:16
2017/03/11 11:58
2017/03/11 13:04
2017/03/12 02:37
2017/03/12 04:22
2017/03/12 04:44
2017/03/12 04:46
2017/03/12 04:51