Help acessing a multidimensional array

Discussion in 'Programming/Scripts' started by filch, Nov 18, 2008.

  1. filch

    filch New Member

    I have the following array that is created by a form. I need to access the various parts of this and create an SQL insert into a relational dB linking table. The array looks like this:
    Code:
    $a_id= Array ( [1] => Array ( [0] => 1 [1] => 2 ) [2] => Array ( [0] => 2 [1] => 3 ) [5] => Array ( [0] => 1 [1] => 3 ) [8] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) 
    So what this represents is the key value is an id of an airport and the value of this key is another array, which represents up to three services available at each airport. So, for example, airport with the id of 1 has two services available with id's of 1 and 2. The airport with id number 8 has all three services available 1, 2 and 3.

    However, I am having trouble accessing this array. I have tried to access for instance the first airport by using $a_id[0] but no luck. Never mind accessing the associated array to airport 1. How would I access the various parts of this array?

    Dave
     
  2. burschik

    burschik New Member

    Is that supposed to be php?
     
  3. filch

    filch New Member

    re: supposed to be PHP

    Well it is part of a PHP script but this is just the output of a print_r on the array so people could see the structure of the array.

    No worries ... I did figure it out finally.

    Dave
     

Share This Page