欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

进来看看这个while循环哪套错了,整个嵌套的循环又重复了一次.

程序员文章站 2022-05-12 11:41:21
...
进来看看这个while循环哪套错了,整个嵌套的循环又重复了一次...
重重复效果如下图所示,


回复讨论(解决方案)

$query = "select * from tbl_department where dpUpID ='0'";
$query_info = mysql_query($query);
while($row = mysql_fetch_array($query_info)){
$query_1 = "select * from tbl_department where dpUpID = ' $row[dpName]'";
$query_info_1 = mysql_query($query_1);
while($row_1 = mysql_fetch_array($query_info_1)){
$query_2 = "select * from tbl_department where dpUpID = ' $row_1[ID]'";
$query_info_2 = mysql_query($query_2);
while($row_2 = mysql_fetch_array($query_info_2)){
}
}
}
筛选范围交叉了吧?