View Full Version : Sorting FQL Mutliquery Results

03-01-2012, 02:21 AM
I'm hoping someone can help me, its late at night and I'm struggling to get my head around this.

I send off a fql multiquery to facebook, and the results come back like such.

[data] => Array
[0] => Array
[name] => birthday_query
[fql_result_set] => Array(//RESULTS)

[1] => Array
[name] => event_query
[fql_result_set] => Array(// RESULTS)

The order in which facebook returns these results has no relation to the order in which they were sent. So I can't rely upon the first query being sent being [0] in the data array, and the second query [1] etc.

How can I rearrange the array so that the name (event_query, birthday_query) is used as the key instead of a useless number that has no relation to anything.

Thanks for any help.. I'm well and truely braindead and off to sleep :o

03-01-2012, 12:01 PM
I'm going to post the answer if anyone's interested. Took about 2 minutes with fresh eyes!! :p

$fb_data = array();

foreach($fql_multiquery_obj[data] as $value)
$fb_data[$value['name']] = $value['fql_result_set'];