1 回答
TA贡献1878条经验 获得超4个赞
在获取SQL数据的函数中,第一次循环后返回结果:
function show_available_equipment($users_site, $timeStampFrom, $timeStampTo){
// defines db from instialize page as a global variable
foreach ($timeStampFrom as $timeStampStart=>$timeStampTo) { // <----- Only runs once
........................
//if there is a SQL error exit
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("Location: book_gear.php?error=sqlerror123");
exit();
}
// otherwise go ahead
else {
...........................
$result = mysqli_stmt_get_result($stmt);
return $result; // <---------- Returns after first loop
}
}
}
从数据库检索每个结果后,您需要将其添加到某种$all_results变量中。循环完成后,返回$all_results。
- 1 回答
- 0 关注
- 87 浏览
添加回答
举报