我是php \ mysql的新手,我正在发布查询数据库并制定“点”列所排列的前十名用户列表的方法。
错误:非法字符串偏移量'用户名'非法字符串偏移量'点'非法字符串偏移量'用户名'非法字符串偏移量'点'未定义偏移量:2未定义偏移量:2未定义偏移量:3未定义偏移量:3点数:cc points1 1点分数点数
我当前的mysql查询:
$result = mysql_query("SELECT username, points FROM users ORDER BY points DESC LIMIT 10")
or die(mysql_error());
$rows=mysql_fetch_array($result);
$top10 = "Points: ";
for($i=0;$i<count($rows);$i++)
{
$top10 .= $rows[$i]['points']." ".$rows[$i]['username']." points";
}
echo $top10;
$result = mysql_query("SELECT username, points FROM users ORDER BY points DESC LIMIT 10")
or die(mysql_error());
$top10 = "Points: ";
while ($row = mysql_fetch_array($result)) {
$top10 .= $row[0]." ".$row[1]." points";
}
echo $top10;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句