源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

php while循环得到循环次数

  • 时间:2022-03-15 12:35 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:php while循环得到循环次数
[u]复制代码[/u] 代码如下:
<?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; ?>
在实际工作,偶尔会用到的。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部