foreach($arrTable as $tableNum){
$strTable.='<tr><td>'.$tableNum.'</td>';
$sql = "SELECT * FROM tb_booking WHERE table_name ={$tableNum} AND date='{$_POST['date']}' ORDER BY ttime ASC";
$rs = mysqli_query($conn,$sql);
$run = 0;
ยัง error อยู่ค่ะ
foreach($arrTable as $tableNum){
$strTable.='<tr><td>'.$tableNum.'</td>';
$sql = "SELECT * FROM tb_booking WHERE table_name ={$tableNum} AND date='{$_POST['date']}' ORDER BY ttime ASC";
$rs = mysqli_query($conn,$sql);
$run = 0;
มันขึ้น error แบบนี้ค่ะ
Fatal error
: Uncaught Error: Call to undefined function mysql_num_rows() in C:\xampp\htdocs\Project\test5.php:98 Stack trace: #0 {main} thrown in
C:\xampp\htdocs\Project\test5.php
on line
98
แก้แล้วค่ะ
foreach($arrTable as $tableNum){
$strTable.='<tr><td>'.$tableNum.'</td>';
$sql = "SELECT * FROM tb_booking WHERE table_name ={$tableNum} AND date='{$_POST['date']}' ORDER BY ttime ASC";
$rs = mysqli_query($conn,$sql);
$run = 0;
$strTable.='</tr>';
}
echo $strTable, '</table>';
?>
ขึ้นerrorแบบนี้แทน
Warning
: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
C:\xampp\htdocs\Project\test5.php
on line
98
select dt.start, dt.number, coalesce(bk.table_number, '<font color="green">Empty</font>') as bk_date
from (
select tb.number, concat( tmp_d.d,' ',tmp_t.t ) as start from
(
select '2021-03-01' as d union
select '2021-03-02' union
select '2021-03-03' union
...
select '2021-03-30' union
select '2021-03-31'
) as tmp_d
join
(
select '09:00' t union
select '10:30' union
select '12:00' union
...
select '21:00'
) as tmp_t
join table_num as tb
) as dt
left join tb_booking as bk
on bk.booking_datetime = dt.start and bk.table_number = dt.number
order by ......
ตอนนี้ตรวจสอบคำสั่ง
$rs = $conn->query('statement') or die( $conn->error);
แล้วขึ้นแบบนี้
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'statement' at line 1