I've been building this and everything is working fine - however, the database that I'm connected to does not update - upon updating the text area, my code even tells me it is successful so I genuinely do not know what is wrong... Code below!
I've checked all the syn taxes, names in the database and letters in my code - nothing seems to be the issue.
Inspecting the page comes up with no errors.
loggedinpage.php
<div class="container-fluid"> 
    <textarea name="diary" id="diary" class="form-control"></textarea>
</div>
<?php   include("footer.php");?>
updatedatabase.php
<?php
    session_start();
    if(array_key_exists("content", $_POST)){ 
        include ("connection.php");
        $query = "UPDATE `users` SET `diary` = '".mysqli_real_escape_string($link, $_POST['content'])."' WHERE id = ".mysqli_real_escape_string($link,$_SESSION['id'])." LIMIT 1";
            if(mysqli_query($link, $query)){
                echo "success";
            } else {
                echo "failed";
            }
    }
?>
connection.php
<?php 
    $link = mysqli_connect("*******", "********", "xxxxxxx", "*******");
        if (mysqli_connect_error()){
            die("Database connection error");
        }
?>
footer.php
   <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    <script type="text/javascript"> 
        $(".toggleForms").click(function(){ 
            $("#signUpForm").toggle();
            $("#loginForm").toggle();
        });
        $("#diary").on('input propertychange', function(){ 
            $.ajax({
              method: "POST",
              url: "updatedatabase.php",
              data: { content: $("#diary").val() }
            })
              .done(function( msg ) {
                alert( "Data Saved: " + msg);
              });
        });
    </script>
 
    