Maison > Article > développement back-end > 跳不出while循环,该怎么解决
跳不出while循环
我想写个分页代码,每个页面显示6种食物,但是好像跳不出循环,不管我进哪一页都是一样的
代码如下:
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> $each_page=6; $diff=$rows % 6; $page_org=$rows / 6; $count=1; if($diff>0) { $page = floor($page_org+1); } else { $page = floor($page_org); } $page_count_start=0; $page_count_end=0; $stopwatch=0; if(!isset($_GET['page']) || (isset($_GET['page'])&&$_GET['page'])==1) { //echo "hello"; $page_num=1; $page_count_end=$page_count_start + 6; } else { //echo "hello"; $page_num=$_GET['page']; $page_count_start=$page_num + ($page_num-1) * 5; $page_count_end=$page_count_start + 6; } $query="SELECT * FROM DISH WHERE dish_id IN (SELECT dish_id FROM CATEGORY_MENU WHERE cat_id=$cat_id)"; $result=queryMysql($query); while($get_details=mysql_fetch_array($result)) { $stopwatch++; if($stopwatch