rishe Posted July 8, 2016 Share Posted July 8, 2016 hi all, i am fetching the data from database in array as Array ( [0] => Array ( [latitude] => 3397019 [longitude] => 8541652 ) [1] => Array ( [latitude] => 3497019 [longitude] => 8641652 ) [2] => Array ( [latitude] => 3597019 [longitude] => 8741652 ) ) now how to convert the above as Array ( [0] =>3397019, 8541652 ) [1] =>3497019,8641652 ) [2] => 3597019, 8741652 ) ) my code for fetching the records is $sql = "SELECT * FROM atm "; $array = array(); $result = mysql_query($sql); if (! $result){ throw new My_Db_Exception('Database error: ' . mysql_error()); } while($row = mysql_fetch_assoc($result)){ $latlon[] = $row; } print_r($latlon); Link to comment Share on other sites More sharing options...
justsomeguy Posted July 8, 2016 Share Posted July 8, 2016 Instead of just adding the entire row to the array, add the elements individually. Add a new value to the array with the latitude and longitude concatenated in the string you want. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now