我正在尝试将默认值插入到新创建的表中,但是创建的表没有值。如何在创建表后使用dbForge插入值?
我的控制器代码如下:
$fields = array('id' =>
array('type' => 'INT','constraint' => 11,
'unsigned' => TRUE,'auto_increment' => TRUE),
'home_bg' => array('type' => 'VARCHAR','constraint' => '200',),
'login_bg' => array('type' => 'VARCHAR','constraint' => '200',),
'other_bg' => array('type' =>'VARCHAR','constraint' => '200',),
'uploaded_on' => array('type' => 'DATE',),);
$this->dbforge->add_field($fields);
$this->dbforge->add_key('id', TRUE);
$this->dbforge->create_table('pr_backgrounds', TRUE);
答案 0 :(得分:0)
试试这个
$fields = array(
'id' => array(
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'home_bg' => array(
'type' => 'VARCHAR',
'constraint' => '200',
),
'other_bg' => array(
'type' =>'VARCHAR',
'constraint' => '200',
),
'uploaded_on' => array(
'type' => 'DATE'
),
);
$this->dbforge->add_field($fields);
$this->dbforge->add_key('id', TRUE);
$this->dbforge->create_table('ipn_log', TRUE);