连续使用三个while循环

时间:2015-07-14 20:18:46

标签: php while-loop

Installing JMeter runtime
Download the _bin and _lib files
Unpack the archives into the same directory structure
The other archives are not needed to run JMeter. 

此代码行正常运行。

  • 首先$connect = mysqli...... $command1 = mysqli.... while($row = mysqli_fetch_array($command1)){ echo $row[]; $command2 = mysqli...... while($row = mysqli_fetch_array($command2)){ echo $row['']; } }
  • 确定第二个while loop直到结束
  • 在第二次结束后,它将返回第一个while loop
  • 重复所有过程,直到条件结束为止。

但是当我添加另一个while condition时,所有逻辑都会下降。

while loop

....按第一,第二和第三回声进行屏幕显示。然后我希望它再次返回$connect = mysqli...... $command1 = mysqli.... while($row = mysqli_fetch_array($command1)){ echo $row[]; $command2 = mysqli..... while($row = mysqli_fetch_array($command2)){ echo $row['']; $command3 = mysqli...... while($row = mysqli_fetch_array($command3)){ echo $row['']; } } } ,但它会返回$command2,按回显并停止。

为什么它会返回$command1而不是first while

有什么区别?

1 个答案:

答案 0 :(得分:1)

<强>更新

你更好地改变你的代码:

$connect = mysqli...
$command1 = mysqli...
$command2 = mysqli...
$command3 = mysqli...
while( $row1 = mysqli_fetch_array( $command1 ) ){
  while( $row2 = mysqli_fetch_array( $command2 ) ){
    while( $row3 = mysqli_fetch_array( $command3 ) ){
    }
  }
}

我相信这样可以解决问题