【发布时间】:2013-11-25 08:53:26
【问题描述】:
我想创建一个数组,像这样传递给插入查询:
$data=array(
'db_field1'=>$value,
'db_field1'=>$value,
'db_field1'=>$value,
and so on
);
$this->db->insert('table',$data) //codeigniter syntax
但我想提前创建数组,然后在匹配条件时继续传递键值对:
if(cond==true)
'"'.$key.'"=>'.$value.',' //pass this to the data array every time the condtion is true
【问题讨论】:
标签: php mysql arrays codeigniter