How to solve this codeigniter issue : i have a database table(Mysql) and i need to move all of it\'s field contents to another table using Php Codeigniter framework ?
Wh
A simple one would be
INSERT INTO table1 (col1, col2, col3)
SELECT col1, col2, col3
FROM table2
In CI use query()
$this->db->query("INSERT INTO table1 (col1, col2, col3)
SELECT col1, col2, col3
FROM table2");
Here is the other way
$data = $this->db->select('col1, col2, col3')->get('table2');
if($data->num_rows())
{
$insert = $this->db->insert('table1', $data->result_array());
}