i need to set a session called BusinessID in php but its not working on my live server , i cannot figure out what is wrong with it
what happens is that it executes the first query but does not set session and redirect to dashboard.php
heres the code
<?php         
if ($link === false) {
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Attempt insert query execution
if(isset($_POST["register"]))
{
    $company = $_POST["company"];
    $address = $_POST["address"];
    $contact = $_POST["contact"];
    $city = $_POST["city"];
    $tags = $_POST["tags"];
    $email = $_POST["email"];
    $password = $_POST["password"];
    $sql="INSERT INTO business(`companyname`, `email`, `password`, `address`, `tel`, `city`, `tag`,`status`, `created_at`,`type`)
VALUES('$company','$email','$password','$address','$contact','$city','$tags','unblocked',CURRENT_TIMESTAMP,'Null')";
    if (mysqli_query($link, $sql)) {
        $query = "select id from business where email='$email' and password='$password'";
        $result = mysqli_query($link,$query);
        if (mysqli_fetch_assoc($result))
        {
            $_SESSION["businessID"] = $result[0]["id"];
            header("Location: dashboard.php");
        }
        else
        {
            header("Location: login.php?Invalid= Please Enter Correct User Name and Password ");
        }
    } 
    else{
        echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
    }
}
// Close connection
mysqli_close($link);
?>
 
     
     
    