I basically created this file with php that takes values from another file to find out whether a car parked got out within the time and if not, he is going to get a fine. I am able to get all the variables and stuff working but when i try to enter to insert the datas into my database in phpmyadmin, i get an error. Here are my codes:
<?php
session_start();
$Entrydates=$_SESSION['tsmdate'];
$Entrytimes=$_SESSION['tsmTime'];
$Exitdates=$_SESSION['tsmexit'];
$ExitTime=$_SESSION['tsmtimeend'];
$username=$_SESSION['tsmUserName'];
var_dump($_SESSION);
        $Error=false;
          date_default_timezone_set('Asia/Riyadh');
        $presentDate=date('Y-m-d');
           if(strtotime($Entrydates) == strtotime($presentDate))
            {
              echo "same date";
            $presentTime= date('h:i A');
        var_dump($presentTime);
        if(strtotime($presentTime) > strtotime($ExitTime))
            {
              echo "pay up";
              $fine=100;
              $Error=true;
           }
          else{
             echo "dont pay up";
             $fine=0;
             $Error=true;
            }
        }
        else
        {
            echo "different dates";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        }
            if($Error==true){
            require_once("connection.php");
            $my_query="INSERT INTO fine (`No`, `Username`,`Fine`) VALUES (NULL,'$username','$fine')";
            $result=mysqli_query($connection,$my_query);
            if($result)
            {
                echo 'thank you';
            }
            else
            {
                echo 'error';
            }
            mysqli_close($connection);
            }
?>
 
     
    