You are combining Object Oriented style with the normal procedural mysqli style. On line 5 you use.
mysqli_connect()
and on line 12 you use.
$connection->prepare()
This will not work, if you'd change $connection to, object oriented style like you do with your prepare statement, it will work.
$connection = new mysqli('localhost', $config['username'], $config['password'], $config['dbname'])
More information can be found here http://php.net/manual/en/mysqli.prepare.php