我在CodeIgniter和MySQL邏輯上可能有問題。我有兩個查詢,我已經執行它們,每個查詢都有一個不同的數組變量,我想把一個變量。從數據庫添加數組行到一個變量
$query1 = $this->db->query("select a from base where id=1");
$query2 = $this->db->query("select b from base where id=2");
$this->data['result'] = $query1->result_array();
$this->data['result'] = $query2->result_array();
它被覆蓋。
嘗試這個 - 函數:$ this->數據[] = $ query1-> result_array();並在下一行$ this-> data [] = $ query2-> result_array(); –