phpMyAdmin DATE变量到SELECT命令 - 致命错误:未捕获的ArgumentCountError

I'm new here and I learn PHP and SQL connection. I want to list from the SQL database the room numbers what are not reserved. I create 2 tables ( rooms and reservation ) with fill some exapmles.

Step 1

If I put direct DATE for the "end reservation" DATE("2019-03-11") like this work well and listed the room numbers

function reserv3()
{
    include "config.php";
    $html = "";
    $sql = 'SELECT roomnr , reserv_start FROM rooms LEFT OUTER JOIN reservation ON reservation.room_id = rooms.room_id AND DATE(reservation.reserv_start)  >= DATE("2019-03-11")';
    $result = mysqli_query($conn, $sql);
    while( $sor = mysqli_fetch_array($result) )
        $html .= "<DIV>".$sor['roomnr'].", ".$sor['reserv_start']."</DIV>";
    return $html;
}

Step 2

I want to replace the fixed DATE("2019-03-11") to a variable.

$today = DATE("2019-03-11");
function reserv3($today)
{
    include "config.php";
    $html = "";
    $sql = 'SELECT roomnr , reserv_start FROM rooms LEFT OUTER JOIN reservation ON reservation.room_id = rooms.room_id AND DATE(reservation.reserv_start)  >= '.$today;     
    $result = mysqli_query($conn, $sql);
    while( $sor = mysqli_fetch_array($result) )
        $html .= "<DIV>".$sor['roomnr'].", ".$sor['reserv_start']."</DIV>";
    return $html;
}

I have in Step 2 the Fatal error Fatal error: Uncaught ArgumentCountError: Too few arguments to function reserv3(), 0 passed in

Can you help me how can I put variable to this command ? Thank you

Something is wrong in your code. PHP date() generates the date. If you want the current date write date ('Y-m-d') for date and date ('Y-m-d H: i: s)' for the date and time. In mysql if the field is the date type you do not have to use the mysql date() function to compare. Only if it is of the datetime type use the date() function to extract the date.

<?php
include "config.php";

$today = DATE('Y-m-d');

function reserv3($today)
{
    global $conn;

    $sql = 'SELECT t1.roomnr , t2.reserv_end FROM reservation as t2 LEFT JOIN rooms as t1 ON t2.room_id = 
               t1.room_id where t2.reserv_end <= '.$today;     
    $result = mysqli_query($conn, $sql);

    if(mysqli_num_rows($result)>0){
     // do something
    }

}