0
可以是PHP或Mysql解決方案... 我希望能夠將已從mysql數據庫中選擇的一些數據存儲在php數組中。到目前爲止,我只能夠放於一個「假」陣列將MySql數據放入多維數組中
$SQL = "SELECT * FROM continents RIGTH JOIN Country ON Country_Continents = continents_ID";
while ($CONT = mysql_fetch_array($DataSet)){
$array_cont[] = $CONT["continents_name"];
$country_ID_rry [] = $CONT;
}
然後我得到的每一個大陸陣列和我大陸陣列獲得國家命名..
Array
(
[0] => Array
(
[0] => America
[continents_name] => America
[1] => 3
[country_id] => 3
[2] => México
[country_name] => México
)
[1] => Array
(
[0] => SouthAmérica
[continents_name] => SouthAmerica
[1] => 2
[country_id] => 2
[2] => Argentina
[country_name] => Argentina
)
[2] => Array
(
[0] => SotuhAmerica
[continents_name] => SouthAmerica
[1] => 5
[country_id] => 5
[2] => Venezuela
[country_name] => Venezuela
)
[3] => Array
(
[0] => SouthAmerica
[continents_name] => SouthAmerica
[1] => 6
[country_id] => 6
[2] => Colombia
[country_name] => Colombia
)
[4] => Array
(
[0] => Caribe
[continents_name] => Caribe
[1] => 1
[country_id] => 1
[2] => Cuba
[country_name] => Cuba
)
)
但我想類似的東西...
Array
(
[SouthAmerica] => Array
(
[0] => Argentina
[1] => Brazil
[2] => Colombia
)
[NorthAmerica] => Array
(
[0] => Usa
[1] => Mexico
[2] => Canada
)
[Europa] => Array
(
[0] => Ukraine
[1] => Germany
[2] => England
)
)
謝謝你!是的,我有這樣的sql querry ... –