Welcome Guest, Not a member yet? Register   Sign In
Non-associative array in codeigniter
#1

[eluser]Unknown[/eluser]
CodeIgniter always returns associative array from model.
suppose I want to get "name" from "user_master" table.So i have written the following query in model

$rows = $this->db->select('Name')
->from('user_master')->get()->result_array();
And the result is as follows:
Array
(
[0] => Array
(
[Name] => Sumanta
)
)
But I want the result as follows

Array(
[0]=>Sumanta
)

How I'll will get it?
#2

[eluser]johnpeace[/eluser]
See Jamie Rumbelow's 'MY_Model' class, he has a method that does exactly what you're describing.

https://github.com/jamierumbelow/codeign..._Model.php




Theme © iAndrew 2016 - Forum software by © MyBB