页面不断加载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()
在每次迭代时执行。因此会导致无限循环