我一直在谷歌搜索和搜索这个论坛,但实际上我还没有找到我需要实现的解决方案。
我以这种形式从数据库中获取一个数组
Array
(
[0] => Array
(
[0] => af
[1] => Afghanistan
)
[1] => Array
(
[0] => al
[1] => Algeria
)
)
我需要它看起来像这样
Array
(
[af] => Afghanistan
[al] => Algeria
)
db 是 sql server,这是我用来获取数据的代码
$sQueryCountries = "SELECT Country_Code,Country_Name FROM Countries WHERE Client_Id = '$client_id'";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$rResultCountries = sqlsrv_query( $db, $sQueryCountries, $params, $options );
while ( $aRow = sqlsrv_fetch_array( $rResultCountries, SQLSRV_FETCH_NUMERIC ) )
{
$output[] = $aRow;
}