【发布时间】:2026-02-22 11:40:01
【问题描述】:
您好,我正在尝试使用“user1”和“score1”等索引填充数组以返回函数。
我的代码:它出现了无法识别的变量错误
$query = 'select * from users order by score desc';
$result = mysql_query($query) or die (mysql_error());
$highscore = array();
$count = '0';
while($row = mysql_fetch_array($result))
{
$count++;
$highscore = array('user' . $count => $row['username'], 'score' . $count => $row['score']);
}
return $highscore;
【问题讨论】: