亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

php while循環(huán)得到循環(huán)次數(shù)

 更新時(shí)間:2013年10月26日 09:47:48   作者:  
在for循環(huán)中,我們很容易得到循環(huán)次數(shù),因?yàn)槭亲鳛闂l件出現(xiàn)的。在while也可以得到,如下:
復(fù)制代碼 代碼如下:

<?php
   $link = mysql_connect('localhost','root','pwd');
   mysql_select_db('db'); 
   $sql = "select region_id,local_name from regions where region_grade=1";
   $result = mysql_query($sql);
 $i =0;
  while ($row= mysql_fetch_assoc($result)) {
        $list[$i]['text']=$row['local_name']; 
        $list[$i]['value']=$row['region_id'];
        $i++;      
   }
  $list = json_encode($list);
  echo   $list;
?>

在實(shí)際工作,偶爾會(huì)用到的。

相關(guān)文章

最新評(píng)論