我希望得到一个下拉框,其中包含:
Madrid (10)
Amsterdam (20)
Paris (5)
New York (14)
所以Ciy的名字+一个点
我正在使用此代码:
$sql = "SELECT city_name, city_point FROM ".CITIES_TABLE."";
$result = mysql_query($sql);
$city_name = array("---");
while ($city_row = $site_db->fetch_array($result)) {
$city_name[] = current($city_row);
$additional_combo_fields['combo_city'] = array($lang['combo_city'],
"dropdown",
0,
$city_name,
0, 0, 0, 0);
}
现在,我得到的只是城市的名称,但我不知道如何获得积分。
提前谢谢你,
答案 0 :(得分:1)
$city_name = $city_row[0]; // or $city_row['city_name']
$city_point = $city_row[1]; // or $city_row['city_point']
见下面的代码:
$sql = "SELECT city_name, city_point FROM ".CITIES_TABLE."";
$result = mysql_query($sql);
$city_name = array("---");
while ($city_row = $site_db->fetch_array($result)) {
$additional_combo_fields['combo_city'] = array($lang['combo_city'],
"dropdown",
0,
$city_row[0].' ('.$city_row[1].')',
0, 0, 0, 0);
}