This is a query which I tried below.
$sql = "SELECT id,due, datediff(date('Y/m/d'), date)  FROM sales
I am writing a sales program for identifying the due payment. If the due payment is more than 7 error displayed payment pending what I tried so far I attached below of the full coding. when I tried the below code error ouput displayed
Notice: Undefined index: datediff(pay_date, date)
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $today = date("Y/m/d");
    $sql = "SELECT id,due, datediff(date('Y/m/d'), date)  FROM sales where due != '0' ";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            $id = $row['id'];
            $paydate = $row["datediff(pay_date, date)"] . " " .  "Days" . "</br>";
            if ($paydate >= 7) {
                $status = "Payment pending";
                $color = "#47f50b";
            } elseif ($paydate >= 3) {
                $status = "Payment pending please settle down the amount";
                $color = "yellow";
            } elseif ($paydate >= 1) {
                $status = "kindly pay the payment";
                $color = "#00a8ff";
            } elseif ($paydate == 0) {
                $status = "Disable your Order";
                $color = "red";
            }
        ?>
 
     
     
    