0
由於我使用的2個數據庫我在配置/ database.php中2個獨立的配置設置,並在模型的構造與
$this->DB1 = $this->load->database('default', TRUE);
$this->DB2 = $this->load->database('reserve', TRUE);
我需要檢索最後插入記錄的ID加載它們,並使用$this->db->last_insert();
和$this->DB2->last_insert();
但都沒有工作。
我插入查詢工作正常,是
$insArray = array(
'propNumber' => $prp,
'fname' => $fname,
'lname' => $lname,
'unit' => $unit,
'email' => $email,
'NOC' => 0
);
$this->DB2->insert('users', $insArray);
$last_id = $this->db->last_insert();
$_SESSION['userID'] = $last_id;
return 'valid';