使用PHP将日期与现有SQL数据库匹配

时间:2017-05-20 17:21:13

标签: php mysql

这是我的代码,以匹配现有的预订日期,以检查特定日期的可用运动,但不工作请帮助

if(isset($_POST['check']))
{   
    $sportName = mysqli_real_escape_string($con, $_POST['game']);
    $bookDate = mysqli_real_escape_string($con, $_POST['date_of_booking']);
    $result = mysqli_query($con,"
SELECT sport_name 
  FROM booking 
 WHERE booking_date='$bookDate'
");     

        if($result == $sportName) 
        {
            echo "Sorry this Sport is booked on selected date by someone else";
        }
        else
        {                   
                echo "Availabe ";                   
        }   
}

0 个答案:

没有答案