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
You need to do it in following manner:-
<?php
session_start();
$config = parse_ini_file('../database_config.ini');
//Create Database connection
$connection = mysqli_connect('localhost',$config['username'],$config['password'],$config['dbname']);
if (mysqli_connect_errno()) { // check the change of if condition
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt = mysqli_prepare($connection,"INSERT INTO report (reportID, userID, description, address, postalcode, latitude, longitude) VALUES(0, 007, 'Major fire', 'Jurong Point', 640724, 1.640724, 103.640724)"); // check the change in query code
mysqli_stmt_execute($stmt); // check the change in execution code
echo "Error:\n";
print_r(mysqli_error($connection)); // check the change in error getting code
mysqli_stmt_close($stmt);// check the change in statement closing code
mysqli_close($connection); // check the change in db connection closing code
?>
For more knowledge refer link and it's example:- http://php.net/manual/en/mysqli.prepare.php