implode the resulting result_array from a db query |
[eluser]sigsauer[/eluser]
I'm trying to return the imploded resulting array from a query like this: $query="SELECT userfavorites.station_id from userfavorites WHERE userfavorites.user_id = $user"; $result = $this->db->query($query); return implode(",",array_values($result->result_array())); All I get is a string containing Array, Array, Array, Array, Array Isn't this possible without having to run a foreach loop?
[eluser]mah0001[/eluser]
result_array() returns a multi dimensional array and it is not possible to flatten the result without iteration. If you want to have a ready made function, see: http://www.php.net/manual/en/function.array-values.php
|
Welcome Guest, Not a member yet? Register Sign In |