I'm about using CodeIgniter for my first project. I have tried to get data from database.
$test = $this->komponen_model->get_participants_id()->result_array();
print_r($test)
Array (
[0] => Array ( [id] => 1 )
[1] => Array ( [id] => 4 )
[2] => Array ( [id] => 7 )
)
And I got this. So, I need to call each element by:
foreach ($test as $ts){
echo $ts['id'];
}
My question is, can I make the array shorten. Just like:
Array (
[0] => 1
[1] => 4
[2] => 7
)
I will be appreciated for anyone's advise.