Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Sorting FQL Mutliquery Results

    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.

    Code:
    Array
    (
        [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

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I'm going to post the answer if anyone's interested. Took about 2 minutes with fresh eyes!!

    PHP Code:
    $fb_data = array();

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

    Simple!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •