multi-dimensional array
| From: | tomhilton | Date: | Thu, 24 Jan 2002 15:52:56 +0000 |
| Subject: | multi-dimensional array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16148@lists.php.net to get a copy of this message | ||
Hi,
I am trying to load a multi-dimensional array to my mysql database and am
having difficulty reading the array.
I created the array in a script, and sent it to another script through a
form. One of the variables that gets passed is "$home_team[][]. with the
outer array being the week #, and the inner array being the home team id#.
Through PHP INFO function, I can see the array exists and has valid values
HTTP_POST_VARS["home_team"] Array
(
[1] => Array
(
[1] => 1
[2] => 3
)
[2] => Array
(
[1] => 2
[2] => 4
)
[3] => Array
(
[1] => 1
[2] => 2
)
[4] => Array
(
[1] => 3
[2] => 4
)
[5] => Array
(
[1] => 4
[2] => 2
)
[6] => Array
(
[1] => 3
[2] => 1
)
)
When I try to view the information as a table, below is what I get:
week_num flight_id match_date match_num home_team_id away_team_id
1 1 2002-01-01 1 Array[1] Array[1]
1 1 2002-01-01 2 Array[2] Array[2]
2 1 2002-01-08 1 Array[1] Array[1]
2 1 2002-01-08 2 Array[2] Array[2]
3 1 2002-01-15 1 Array[1] Array[1]
3 1 2002-01-15 2 Array[2] Array[2]
4 1 2002-02-05 1 Array[1] Array[1]
4 1 2002-02-05 2 Array[2] Array[2]
5 1 2002-02-12 1 Array[1] Array[1]
5 1 2002-02-12 2 Array[2] Array[2]
6 1 2002-02-19 1 Array[1] Array[1]
6 1 2002-02-19 2 Array[2] Array[2]
The script that generated this table is calling for $home_team[$b][$c],
where $b=The Week #(1-6), and $c=match#(1-2).
I dont understand why it is outputting "Array[1] or Array[2] instead of the
home team id#, that I see is getting passed. Can anyone please help?