0
我無法讓數組顯示出來。從查詢中拆分數組
$womensLevels = array('WEXHIB' => 'Exhib Camp/Test', 'WLEVEL01' => 'Level 1', 'WLEVEL02' => 'Level 2', 'WLEVEL03' => 'Level 3', 'WLEVEL04' => 'Level 4', 'WLEVEL05' => 'Level 5', 'WLEVEL06' => 'Level 6', 'WLEVEL07' => 'Level 7', 'WLEVEL08' => 'Level 8', 'WLEVEL09' => 'Level 9', 'WLEVEL10' => 'Level 10', 'WOPEN' => 'Open', 'WPREPOPT' => 'Prep OPT', 'WTOPS' => 'TOPS');
它結束了像這樣,當我做我的查詢,並將其放入我的觀點(HTML)。我只想讓代碼鍵和描述鍵顯示值。
[0]=>
array(2) {
["Code"]=>
string(4) "IW01"
["Description"]=>
string(13) "Intro Level 1"
}
[1]=>
array(2) {
["Code"]=>
string(4) "IW02"
["Description"]=>
string(13) "Intro Level 2"
}
[2]=>
array(2) {
["Code"]=>
string(4) "IW03"
["Description"]=>
string(13) "Intro Level 3"
}
這是我的疑問。
這是數組來自的地方。
$womensLevels = sprintf("SELECT `Code`,`Description` FROM `mb_ro_type_codes` where `Program` = '%s'", $sanction->Program);
$smarty->assign('womensLevels', $db->query($womensLevels));
這是我的html我把我的變量從我的控制器。
{html_checkboxes name='code' options=$womensLevels selected=$checked}
我想我想問的是如何分解我的數組?
這是正確的答案。謝謝! :) – wowzuzz 2012-01-10 21:09:11