跳不出while循环
我想写个分页代码,每个页面显示6种食物,但是好像跳不出循环,不管我进哪一页都是一样的
代码如下:
$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<$page_count_start) { //$stopwatch++; continue; //这里好像跳不出去,试了一下,不管进哪一页都是一样的 } $dish_id=$get_details['dish_id']; $dish_price=$get_details['dish_price']; $dish_name=$get_details['dish_name']; $dish_img=$get_details['img_url']; $dish_descr=$get_details['dish_description']; //echo "$dish_id $stopwatch"; $page_count_start++; if($page_count_start==$page_count_end+1) { $stopwatch=0; break; } //echo ".....";}