![]() |
Possible to return database row with a key instead as numeric indexes? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Possible to return database row with a key instead as numeric indexes? (/showthread.php?tid=61166) |
Possible to return database row with a key instead as numeric indexes? - El Forum - 10-04-2014 [eluser]Unknown[/eluser] For example if I do Code: Select * from Persons Where Person has the columns: Name (Primary Key), Address, Phone And I turn the returned Rows as an array I'll get Code: [0] => Array But is there a way to get it so it'll be like Code: ["John Mang"] => Array Thanks. Possible to return database row with a key instead as numeric indexes? - El Forum - 10-04-2014 [eluser]rufnex[/eluser] You have to reorganize your result array like that for e.g. Code: $result = $query->result_array(); |