CodeIgniter Forums

Full Version: database class :: select via array?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ner0tic[/eluser]
i was looking through the forums and the userguide and couldn't find an answer.

real easy one, can i use an array in the select method of the db class?

ie:
$arr = array('id','name','date');
$this->db->select($arr);

El Forum

[eluser]davidbehler[/eluser]
You could have tried it yourself, but you are lucky that I am curious aswell and tried it for you:

Code:
$this->db->select(array('id', 'name', 'date'));
works just fine

Seems not to be document, maybe someone can update the user guide.

El Forum

[eluser]ner0tic[/eluser]
[quote author="waldmeister" date="1233533346"]You could have tried it yourself, but you are lucky that I am curious aswell and tried it for you:

Code:
$this->db->select(array('id', 'name', 'date'));
works just fine

Seems not to be document, maybe someone can update the user guide.[/quote]

sorry i didn't follow up. I just tried it when i got a second to go back to it. I was dealing with odd data being returned from a bad index i grabbed from the result, but yes adding this to the user_guide wouldn't hurt.