gpt4 book ai didi

php - 使第一个查询的结果成为第二个查询的 NOT IN 部分

转载 作者:可可西里 更新时间:2023-11-01 09:03:56 26 4
gpt4 key购买 nike

<分区>

我有两个 MySQL 表:

表 officehours (ID, dayslot, appt_time)表appt(ID,appt_date,appt_time)

我想选择特定日期(例如 2016-01-26)的所有办公时间,当时没有预约。 (可用预约时间)

在我的查询代码中,我有:

// get BOOKED appointment times
mysql_select_db($database_IHC, $IHC);

$query_booked18 = "SELECT appt_time FROM appt WHERE appt_date =
'".$monthyear."-".$monthnum."-18'";

$booked18 = mysql_query($query_booked18, $IHC);

// MAKE BOOKED QUERY PART OF NOT IN STATEMENT FOR AVAILABLE QUERY

while($row = mysql_fetch_array($booked18)){
$temp[] = '"'.$row[0].'"';

// PUT COMMAS BETWEEN VALUES
$bookedstmt18 = implode(",",$temp);

// AVAILABLE APPOINTMENTS QUERY
$query_available18 = "SELECT * FROM officehours WHERE dayslot =
(dayofweek('".$monthyear."-".$monthnum."-18')-1) AND appt_time NOT IN
(".$bookedstmt18.") ORDER BY (date) desc";

$available18 = mysql_query($query_available18, $IHC);

$row_available18 = mysql_fetch_assoc($available18);
$totalRows_available18 = mysql_num_rows($available18);

在我的日历显示约会的部分 (18.php),我有:

//check to see if closed first
if ($totalRows_closed18 > 0 ) {
echo "<td>CLOSED: </td><td>".$row_closed18['reason']."</td>";
echo $query_available18;
} else { // SHOW AVAILABLE APPOINTMENTS
echo '<td width="92" height="75" align="left" valign="top" style="text- align: left">';
do {
<a href="https://innerhealerchiropractic.com/index.php/appt/VIPschedule/" class="w3-link"><?php echo $row_available18['appt_time']; ?></a></br>
<?php } while ($row_available18 = mysql_fetch_assoc($available18));
echo '</td><td width="92" align="left" valign="top" style="text- align:left">&nbsp;</td>';
} // END SHOW APPOINTMENTS ?>

我收到一个错误-

"Error 500 mysql_fetch_assoc() expects parameter 1 to be resource, boolean given"

谁能帮我解决这个问题?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com