insert() public method

Compiles an insert string and runs the query
public insert ( $table = '', $set = NULL, boolean $escape = NULL ) : boolean
$escape boolean Whether to escape values and identifiers
return boolean TRUE on success, FALSE on failure
示例#1
0
 public function add($data)
 {
     $data = $this->check_fields($data);
     if (array_key_exists('created', $this->table_fields)) {
         $data['created'] = date('Y-m-d H:i:s');
     }
     $this->db->insert($this->table, $data);
     $CR = new CI_DB_result($this->db);
     return mysqli_insert_id($CR->conn_id);
 }
 public function add($data)
 {
     $this->db->insert($this->table, $data);
     $CR = new CI_DB_result($this->db);
     return mysqli_insert_id($CR->conn_id);
 }