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
Recognising Revenue daily
Hello.
Has anyone come across daily recognition of deferred income?
We want to implement R
Weird MySQL error, why am I recieving this?
PHP Code:
<?php require "global_settings.php"; ?>
<titl
JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w
Apple's revamped lineup arrives
I'm personally curious about the magic mouse.. a multi-touch concept sounds like it could be nea
Perplexing problem showing a .jpg
Please disregard..........I figured it out
pspell
using pspell, is it possible to get words that would be best in the current phrase?
For examp
retrieving more than one max key from an array?
so i have an array of 20 numerical values (0-100) that i need to order from highest to lowest and th
How to find OS bit version
How can I tell the person browsing my site is running 32, or 64 bit operating system?
Check before inserting in DB ???
This is my code
---------------
if ( $_POST ['Submit'])
{{
$username = $_POST ['usernm
Database/Table Collation
What is the Database, and table collations used for? i don't understand what there used for since co