Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
页面不断加载don';循环php时不显示结果_Php_Mysql_While Loop - Fatal编程技术网

页面不断加载don';循环php时不显示结果

页面不断加载don';循环php时不显示结果,php,mysql,while-loop,Php,Mysql,While Loop,我有一个从数据库中查找结果的函数。我正在使用while loop和mysqli\u fetch\u assoc()从数据库中获取结果。但是页面一直在加载,并且没有显示任何错误 循环 <?php while ($job = mysqli_fetch_assoc(find_all_jobs())) { ?> <tr class="custom-table-body-titles"> <td><?php echo $job['updated-a

我有一个从数据库中查找结果的函数。我正在使用
while loop
mysqli\u fetch\u assoc()
从数据库中获取结果。但是页面一直在加载,并且没有显示任何错误

循环

  <?php while ($job = mysqli_fetch_assoc(find_all_jobs())) { ?>
  <tr class="custom-table-body-titles">
    <td><?php echo $job['updated-at']; ?></td>
    <td>
      <a href="#" class="text-dark"><?php echo $job['title']; ?></a>
    </td>                
    <td>0/<?php echo $job['required_freelancers']; ?></td>
    <td><?php echo $job['delivery_time']; ?> Days</td>
    <td>$<?php echo $job['budget']; ?></td>
    <td>
      <a href="job_details.html" class="btn btn-sm btn-primary">Apply</a>
    </td>
  </tr>
  <?php } ?>

find_all_jobs()
的结果分配给一个变量并运行循环:

<?php 
$jobs = find_all_jobs();
while ($job = mysqli_fetch_assoc($jobs)) { ?>


因为当前您的
find_all_jobs()
在每次
迭代时执行。并因此导致一个无限循环

find_all_jobs()
的结果分配给一个变量并运行循环:

<?php 
$jobs = find_all_jobs();
while ($job = mysqli_fetch_assoc($jobs)) { ?>

因为当前您的
find_all_jobs()
在每次
迭代时执行。因此会导致无限循环