I apologize if this might have been asked before, or if this isn't even possible, but here is what I am hoping to get from a particular table using MySQL.
Say, I have the following table:
+-------------+------------------+
| property | value |
+-------------+------------------+
| style | unisex |
| color | blue |
| type | small |
+-------------+------------------+
I would like to be able to fetch the two columns property and value as an associative array from MySQL, so the end result would be:
array(
'style' => 'unisex',
'color' => 'blue',
'type' => 'small',
);
Just to provide context so people don't misinterpret what I'm asking:
I already know how I can do this using PHP once I have the result back from a generic SQL statement that would return each row's columns as key => value pairs. I was just wondering if it was possible to return one column's value as a key and the second value as the value to the key for each row from MySQL directly to continue with in PHP.
PHPto accomplish that once I have the result from the MySQL query. I was just wondering if it was possible to do it from SQL directly.