I want to define an array bidimensional as a session array.
<?
$continents = array (1 => $europe, $america, $oceania, $africa, $asia);
$i = 1;
do {
$search_countri es = mysql_query("SE LECT COUNTRY_CODE, COUNTRY_$lang
FROM countries WHERE CONTINENT_CODE = $i ORDER BY COUNTRY_$lang ASC");
$j = 0;
while ($row = mysql_fetch_arr ay($search_coun tries, MYSQL_NUM)) {
$countries[$j][0] = $row[0];
$countries[$j][1] = $row[1];
$key_country = $countries[$j][0];
$count_coasters _country = mysql_query("SE LECT COUNT(*) FROM coasters
WHERE COUNTRY_CODE = '$key_country'" );
$total_coasters _country = mysql_result($c ount_coasters_c ountry,0,0);
$countries[$j][2] = $total_coasters _country;
$countries[$j][3] = $i;
$j = $j + 1;
}
$i = $i + 1;
} while ($i < 6 );
$_SESSION["paises"] = $countries; Here I assign my array from 147 rows
and 2 columns (1st column for code, 2nd column for name)to a session
array.
But now I don't know how to make a reference to each individual
element, as I would do with the original array countries, for example:
$country[0][1],$country[2][1], etc.
How should I do?
<?
$continents = array (1 => $europe, $america, $oceania, $africa, $asia);
$i = 1;
do {
$search_countri es = mysql_query("SE LECT COUNTRY_CODE, COUNTRY_$lang
FROM countries WHERE CONTINENT_CODE = $i ORDER BY COUNTRY_$lang ASC");
$j = 0;
while ($row = mysql_fetch_arr ay($search_coun tries, MYSQL_NUM)) {
$countries[$j][0] = $row[0];
$countries[$j][1] = $row[1];
$key_country = $countries[$j][0];
$count_coasters _country = mysql_query("SE LECT COUNT(*) FROM coasters
WHERE COUNTRY_CODE = '$key_country'" );
$total_coasters _country = mysql_result($c ount_coasters_c ountry,0,0);
$countries[$j][2] = $total_coasters _country;
$countries[$j][3] = $i;
$j = $j + 1;
}
$i = $i + 1;
} while ($i < 6 );
$_SESSION["paises"] = $countries; Here I assign my array from 147 rows
and 2 columns (1st column for code, 2nd column for name)to a session
array.
But now I don't know how to make a reference to each individual
element, as I would do with the original array countries, for example:
$country[0][1],$country[2][1], etc.
How should I do?
Comment