然而,当我想在where条件下的第二个查询中使用它们时,我从第一个查询中正确地得到了结果,我得到了查询错误1064。如果我把它移到哪里就好了。另外,当我在第二个查询代码中尝试回显内部变量时,它将打印出来
$queryDate = "SELECT date , time from DATES where ID = $ID";
$result = mysqli_query($connection, $queryDate);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$date = $row['date'];
$time = $row['time'];
}
}
$queryCom = "SELECT * from DATES, BOOKING where dates.time = $time and booking.IDofFullDate= $date";
$result1 = mysqli_query($connection, $queryCom);
if (!$result1)
{
die("Query Faile". mysqli_errno($connection));
}
if ($result1->num_rows >0) {
echo $date;
echo $time;
}
1条答案
按热度按时间ccrfmcuu1#
在第二个查询中,请尝试以下操作: