Here is my query to get a single column from t
$sql = "SELECT `id` FROM `loc8_groups`";
$query = $this->db->query($sql);
print_r($query>result());
Its produce array result like this way.
Array
(
[0] => stdClass Object
(
[id] => 1
)
[1] => stdClass Object
(
[id] => 2
)
[2] => stdClass Object
(
[id] => 3
)
)
But i want result as single associative array that contains all the ids
.
Try this code:
$sql = "SELECT `id` FROM `loc8_groups`";
$query = $this->db->query($sql);
$array1=$query>result_array();
$arr = array_map (function($value){
return $value['id'];
} , $array1);
print_r($arr);