CodeIgniter Forums
Passing array of fields to select - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Passing array of fields to select (/showthread.php?tid=44235)



Passing array of fields to select - El Forum - 08-08-2011

[eluser]Unknown[/eluser]
In documentation it is told that you can pass only string to ActiveRecord's select method, but looking at code, I see, that it is possible to pass array too. Actually it gets converted to array if it is comma-separated string.
Code:
if (is_string($select))
{
    $select = explode(',', $select);
}
So the question is: is it OK if I pass array to select (will it work in next versions of CodeIgniter)? Or maybe you could add this to documentation?

The reason why I need to pass array (not string) of fields is because the list is generated dynamically and it is easier to manipulate arrays than comma-separated strings.