Link to home
Start Free TrialLog in
Avatar of blorriman
blorrimanFlag for Canada

asked on

Codeigniter convert array to string

I think this is a really stupid question, but I'm trying to get all the email addresses from a database into a string so I can send an email to everyone in the database (it never gets bigger than 25 emails) by using $list ($this->email->to($list)), instead of using a foreach which is slow because it has to send each email.

Here's a simple test that shows there are 8 rows, but $list->result_array() just displays Array and print_r($list) shows all the information.

My question is how do I into a string ($list) that I can use for $this->email->to($list) ?
function get_emails() {
        $this->db->select('email');
        $list = $this->db->get('users');
        
        echo $list->num_rows() . '<br />';
        echo $list->result_array() . '<br />';
        print_r($list) . '<br />';
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of redlegoreng
redlegoreng

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial