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);
Did you know?Explore Trending and Topic pages for more stories like this.
}
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
Writing Windows Device Drivers with C
Yes: one of the nice features of C is void*. You can put anything there and get anything out. Very
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
Just wondering what you think about my site
I am new to phpfreaks i just seen this form and thought it would be cool to see what other thought a
how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s
PEAR Email Attachment w/ $gpg
I have no issues with this code if I take out the attachement section and include the info in the em
Problem with DB connection
Hello there! I'm new to this forum and I'm new to PHP coding also. I wrote something that doesn't ma
storing video files into mysql in php
hi
i have my video files in my folder ,
i have to store the path of the videos into db an
Simple code help with redirects
I am trying to figure out a redirect script that detects if the browser is IE 7 and if it does, redi
How to give the privillege for triggers?
Hi,
How to give the privillage for triggers to particular user?
Please let me
Help with file_get_html
The following code gives the expected results:
<html>
<head&g