Home  >  Article  >  Backend Development  >  请高手帮忙看一下,为什么这个循环只执行一次就不执行了解决方法

请高手帮忙看一下,为什么这个循环只执行一次就不执行了解决方法

WBOY
WBOYOriginal
2016-06-13 13:35:33866browse

请高手帮忙看一下,为什么这个循环只执行一次就不执行了
$list是一个二维数组,存放由数据库取来的记录,
程序的目的是:根据每条记录中获取到的regionid得到regionname并将其添加到数组中.
现在的问题是:这个循环每次只能输出一条记录.
$this->get_region可以正常工作,在输出的一条记录里,可以获取到内容.

类中有问题的一段代码:

$list = array();
while ($row = $this -> db -> fetch_assoc()) {
$row['regionname'] = $this -> get_region($row['regionid']);
$list[] = $row;
}

------解决方案--------------------
print_r($list);
我想看看到底都是啥东西.


------解决方案--------------------
print_r($list); 看看输出什么结果

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn