我發現一些問題與此問題相同,但我似乎無法爲自己的代碼找到正確的答案。所以我會發布我的問題。如何使用代碼選擇活動記錄插入記錄
我的代碼不工作,併發布錯誤。像「stdClass無法轉換爲字符串」或有關數組的問題。
這裏是我的模型代碼
$this->db->select("*");
$this->db->from("table1");
$query = $this->db->get();
$this->db->insert("table2", $query->result());
這是行不通的。
現在當我使用print_r($查詢)結果是這樣的。
CI_DB_mysql_result Object ([conn_id] => Resource id #30 [result_id] => Resource id #40 [result_array] => Array () [result_object] => Array () [custom_result_object] => Array () [current_row] => 0 [num_rows] => 5 [row_data] =>)
如果在第3行和第4行之間添加'echo $ query;'和'print_r($ query)',會發生什麼? – brandonscript
對不起,最近的回覆@ r3mus我已經更新了我的帖子 – Vincent