Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 18th November 2008, 02:01
filch filch is offline
Join Date: Jul 2008
Posts: 43
Thanks: 1
Thanked 0 Times in 0 Posts
Default Help acessing a multidimensional array

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:
$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?

Reply With Quote
Sponsored Links
Old 18th November 2008, 11:36
burschik burschik is offline
Junior Member
Join Date: May 2008
Posts: 24
Thanks: 0
Thanked 2 Times in 2 Posts

Is that supposed to be php?
Reply With Quote
Old 18th November 2008, 16:28
filch filch is offline
Join Date: Jul 2008
Posts: 43
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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.

Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to cast a char ptr to an array (to prevent warning, it does work) Owen_Townsend Programming/Scripts 0 4th September 2008 02:12
Debian: Failed Raid5 Array & Kernal Panic snowfly Installation/Configuration 0 29th August 2007 13:52
Warning: fwrite(): supplied argument is not a valid stream resource Salvis General 7 4th July 2007 16:43
log files, rotation and emailing them hairydog2 General 65 11th October 2006 14:18
phpMyAdmin - panick attack md@waw.co.uk General 6 3rd September 2006 21:52

All times are GMT +2. The time now is 02:13.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.