I am using MySQLi to create and use statements. For this I am using a divide and conquer strategy hopefully to make it so that I can create what I need to.
For this, I currently have 2 classes, a config file and my index file (this index is pointless to see).
The behaviour that I am currently expecting is for an sql statement to be prepared ready for working with printed to the screen using var_dump, but, what I get is an fatal error:
Call to a member function bind_param() on boolean.
This occurs in my Logger class, this class is as follows:
<?php
class Logger
{
    private $lastLoggged;
    private $lastLogId;
    public function __construct() {  }
    public function Log($heading, $body, $refNum)
    {
        global $link;
        if (!$link)
            die("Cannot connect to database.");
        $heading = $link->real_escape_string($heading);
        $body = $link->real_escape_string($body);
        $refNum = $link->real_escape_string($refNum);
        $log_qry = $link->prepare("INSERT INTO `logs` (`heading`, `body`, `ref_num`) VALUES (:heading, :body, :refNumber);");
        $log_qry->bind_param(":heading", $heading);
        $log_qry->bind_param(":body", $body);
        $log_qry->bind_param(":refNumber", $refNum);
        var_dump($log_qry);
    }
}
?>
As you can see, there is a global $link statement in this, and this is got from my config file below:
<?php
require_once 'classes/Database.php';
$db = new Database();
$link = $db->mysqli;
require_once 'classes/Logger.php';
$log = new Logger();
$log->Log("heading", "body", "#123");
?>
The database connection that is created, is done with this class:
<?php
class Database
{
    private $hostname;
    private $username;
    private $password;
    private $database;
    /** @var mysqli */
    public $mysqli;
    public function __construct()
    {
        $this->hostname = "localhost";
        $this->username = "root";
        $this->password = "";
        $this->database = "sites";
        $this->mysqli = new mysqli($this->hostname, $this->username, $this->password, $this->database);
    }
}
?>
I know that the connection is live as I have tested this out of the Logger class using var_dump($link); and also by querying the database.
Edit:
Error from $link->error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':heading, :body, :refNumber)'
