mysqli_fetch_assoc returns multiple arrays, how to return a single array
Posted on
16th Feb 2014 07:03 pm by
admin
Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:
Code: [Select]while($row = mysqli_fetch_assoc($result)) {
print_r($row);
}
But this returns multiple arrays like:
Code: [Select]Array ( [key] => air_conditioning [label] => Air Conditioning ) Array ( [key] => balcony [label] => Balcony ) Array ( [key] => cable [label] => Cable ) Array ( [key] => cleaning_service [label] => Cleaning Service ) Array ( [key] => data_ports [label] => Data Ports ) Array ( [key] => dishwasher [label] => Dishwasher ) Array ( [key] => fireplace [label] => Fireplace ) Array ( [key] => fitness_center [label] => Fitness Center ) Array ( [key] => garage [label] => Garage ) Array ( [key] => hardwood_floors [label] => Hardwood Floors ) Array ( [key] => internet [label] => Internet ) Array ( [key] => jacuzzi [label] => Jacuzzi ) Array ( [key] => kitchen_island [label] => Kitchen Island ) Array ( [key] => ocean_view [label] => Ocean View ) Array ( [key] => paid_electricity [label] => Electricity ) Array ( [key] => paid_gas [label] => Gas ) Array ( [key] => paid_water [label] => Water ) Array ( [key] => pool [label] => Pool ) Array ( [key] => refrigerator [label] => Refrigerator ) Array ( [key] => secured_entry [label] => Secured Entry ) Array ( [key] => security_system [label] => Security System ) Array ( [key] => stove [label] => Stove ) Array ( [key] => tennis_court [label] => Tennis Court ) Array ( [key] => underground_parking [label] => Underground Parking ) Array ( [key] => walk_in_closets [label] => Walk In Closets ) Array ( [key] => washer_and_dryer [label] => Washer and Dryer ) Array ( [key] => yard [label] => Yard )
Is there a way to return a single array like:
Code: [Select]array(air_conditioning => Air Conditioning, balcony => Balcony, cable => Cable, etc...)
Thanks.
No comments posted yet
Your Answer:
Login to answer
203
34
Other forums
need help with this contact form
I made this form and I need it to read the data and write the data to a table and its not working ca
how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are tw
Help with some dates
I have a list of dates in an array:
$mondays = array(
strtotime("October 12, 2009
in php, link returns to the line
When I add a link in a php page, the link word returns to the line (as a
would do)
Examp
Problem with PHP/mySQL login code
Hello,
There is an error in my login script and I can't figure out what it is...
I believe
PHP5 - AJAX help
I've been following the tutorial on w2schools (http://www.w3schools.com/php/php_ajax_database.asp) a
Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data
Number Format
Hi All,
I have number '000000000050085' I want to format it to 500.85 Can any one give me
Displaying image pathname instead of image
Hello
Im trying to upload and then display images from a mysql database - Its only basic and
Delete Client 066 Earlywatch
Hi all,
in former times client earlywatch was required for SAPs remote access to SAP inst