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
Generate multilayered array from string.
ok so i have a string that looks like this:
Code: blog:edit_all,delete_all|users:edit_all,delete_
how do i make new line after *
First check this page here. and you see my report. Im pulling form a mysql db. I want to beable to m
ORA-00932: inconsistent datatypes: expected - got CLOB
SO : windows xp
database : XE
there is a table (transito) with two fields of clob
How to get exact 3 moths post date from today date using javascript
How to get exact 3 moths post date from today date using javascript
Please help
pagination - need help on passing of search query.
Hi, i have been trying for days but couldn't get this sorted out. Would like some professional help
Adding Different Numbers From MySQL
Basically I have a mysql database with a couple prices as the following:
9.99
9.99
9.99
styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those.
Pagination
Hi All,
I think I'm finally getting somewhere with pagination!
I can now submit a quer
tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e
More pug propaganda.
http://www.youtube.com/watch?v=8Kkrmubsgf8
The commercial is definitely worth watching pug aw