我有这个表大约有5列
column1, user_id, column3, column4, user_exp
如果我做这样的选择查询
$mat_sql = mysql_query(
"SELECT *
FROM users
ORDER BY user_exp DESC LIMIT 10", $general);
我如何只使用user_id
和user_exp
将user_id as the key
和user_exp as the value
放入数组中?
由于
答案 0 :(得分:2)
$mat_sql = mysql_query("SELECT user_id, user_exp FROM users ORDER BY user_exp DESC LIMIT 10", $general);
while ($row = mysql_fetch_assoc($mat_sql)) {
$result['user_id'] = $row['user_exp'];
}