CodeIgniter Forums

Full Version: Array without keys (index) from DB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I need to get emails from my DB and insert this into email method. I need array without keys:

PHP Code:
$emails = array (
       
'email1@domain.com',
       
'email2@domain.com',
       
'email3@domain.com',
       
// etc


How Can I reach this?
PHP Code:
<?php


$query 
$this->db->select('email_address')
    ->from('emails')
    ->get();

if( 
$query->num_rows() > )
{
    foreach$query->result() as $row )
    {
        $emails[] = $row->email_address;
    }