That's my queries below:
$result4 = $this->db->query('SELECT team_leader_id FROM teams WHERE team_money < 0')->result_array();
$this->db->insert( 'd_teams', array( 'leader_id' => $result4[0]['team_leader_id'] ) );
Yes, it works but it works for only 1 row and there can be multiple or even 50 for example. How I can edit that so it will support all available rows that the select query return? So, it will insert them all in separate rows in the d_teams table. Thanks a lot!