CI数据库操作

同一连接多个数据库切换,db_select($database_name)

$this->db->db_select('aaa');
$res = $this->db->get('z_attr')->result_array();

 

insert_batch()

insert_batch($table[$set = NULL[$escape = NULL[$batch_size = 100]]])

 

参数:
  • $table (string) -- Table name
  • $set (array) -- Data to insert
  • $escape (bool) -- Whether to escape values and identifiers
  • $batch_size (int) -- Count of rows to insert at once
返回:

Number of rows inserted or FALSE on failure

返回类型:

mixed

Compiles and executes batch INSERT statements.

注解

When more than $batch_size rows are provided, multiple INSERT queries will be executed, each trying to insert up to $batch_size rows.

 

$rs[0]['rs']=1;
$rs[0]['val']=2;        
$res=$this->db->insert_batch('val',$rs);

 

 

 

insert_batch($table[$set = NULL[$escape = NULL[$batch_size = 100]]])
参数:
  • $table (string) -- Table name
  • $set (array) -- Data to insert
  • $escape (bool) -- Whether to escape values and identifiers
  • $batch_size (int) -- Count of rows to insert at once
返回:

Number of rows inserted or FALSE on failure

返回类型:

mixed

Compiles and executes batch INSERT statements.

注解

When more than $batch_size rows are provided, multiple INSERT queries will be executed, each trying to insert up to $batch_size rows.

posted @ 2024-03-28 17:30  哆啦阿梦  阅读(5)  评论(0编辑  收藏  举报