public function insert($table = '', $set = NULL, $escape = NULL)
{
if ($set !== NULL) {
$this->set($set, '', $escape);
}
if ($this->_validate_insert($table) === FALSE) {
return FALSE;
}
$sql = $this->_insert($this->protect_identifiers($this->qb_from[0], TRUE, $escape, FALSE), array_keys($this->qb_set), array_values($this->qb_set));
$this->_reset_write();
return $this->query($sql);
}
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); }