Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 你能告诉我为什么这只能排序到10吗?_Php_Sorting_Mysqli - Fatal编程技术网

Php 你能告诉我为什么这只能排序到10吗?

Php 你能告诉我为什么这只能排序到10吗?,php,sorting,mysqli,Php,Sorting,Mysqli,下面是一段代码,它从我的数据库中提取我的所有数据,对它们进行排序,并显示它们,它目前按投票数排序,最多10票,似乎只对第一个数字进行排序 <tr bgcolor="transparent"> <td colspan="3" class="pages"><?php echo $pages_site; ?></td> </tr> <?php foreach($members as $member){ $votes =

下面是一段代码,它从我的数据库中提取我的所有数据,对它们进行排序,并显示它们,它目前按投票数排序,最多10票,似乎只对第一个数字进行排序

<tr bgcolor="transparent">
    <td colspan="3" class="pages"><?php echo $pages_site; ?></td>
</tr>
<?php foreach($members as $member){
    $votes  =htmlentities($member['votes']);
    $id     =htmlentities($member['id']);
    $url    =htmlentities($member['first_name']);
    $sname  =htmlentities($member['last_name']);
    $status =htmlentities($member['status']);
    $desc   =htmlentities($member['bio']);
    $banner =htmlentities($member['image_location']);
?>
<tr>
    <td class="site"></td>
    <td class="site_th"><A href="<?php echo $url ?>"><?php echo $sname ?><br><? echo $desc ?></br><a href="<?php echo $url ?>"><img src="<? echo $banner ?>" style="max-width:500px;max-height:200px";></A></td>
    <td class="vote_th">VOTES:<?php echo $votes ?><br><a href="vote.php?id=<?php echo $id ?>">VOTE!</a> </td>
</tr>
<?
    }
?></table>

我已经尝试将投票移动到db的顶部,并尝试将投票的defult值更改为00而不是0,但这会使它显示01而不是1,我更希望避免,如果可能的话

回显$members变量,并查看数组中的元素总数,我假定只有10个元素,因此,它只上升到10。请确认:'$members=$users->get_users;公共函数get_users{$query=$this->db->prepareSELECT*FROM users ORDER BY voots DESC;try{$query->execute;}catchPDOException$e{die$e->getMessage;}return$query->fetchAll;}你是否正确阅读了我的评论?请再读一遍并回复!呵呵,老兄,我让你检查$members变量,可能是通过回显它,这样你就可以看到数组中有多少元素了!当输出为数组时;大堆大堆大堆大堆我决定向您展示$members变量是什么。此外,我也无法训练如何编写总结评论的代码;无论如何,请清楚地解释你的问题,因为我们没有进展。您的问题似乎在问,为什么您的代码只排序到值10。看起来你并没有在代码中对我进行任何排序。它只排序到10的一个原因是因为foreach循环只执行了10次,因为members变量只有10个元素