I keep getting the error Call to a member function fire_query() on a non-object, it's really frustrating, I just don't know what is wrong.
my class:
require_once("MySQLDatabase.class.php");
global $database;
$result = $database->fire_query($query);
$object_array = array();
This is my MySQLDatabase class
<?php
require_once("config.php");
class MySQLDatabase_class
{
//Some stuff
public function fire_query($query)
{
$result = mysqli_query($this->db_connection, $query) or die("<font color='red'>Error code: 1x1003</font><br>".$query);
return $result;
}
//Some more stuff
}
$database = new MySQLDatabase_class();
?>
I have done this tons of times, and it always works. I just can't figure it out why "global $database" doesn't work.
You have to create new object here:
require_once("MySQLDatabase.class.php");
$database = new MySQLDatabase_class();
global $database;
$result = $database->fire_query($query);
$object_array = array();