-1

我有这张桌子,里面有大约 5 列

column1, user_id, column3, column4, user_exp

如果我做这样的选择查询

$mat_sql = mysql_query(
 "SELECT * 
  FROM users 
  ORDER BY user_exp DESC LIMIT 10", $general);

我如何将user_idanduser_exp放入数组中,使用user_id as the keyand user_exp as the value

谢谢

4

1 回答 1

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'];
}
于 2012-09-16T09:55:26.513 回答