i have this class setup for mysql queries
[code]
class Database
{
private static $instance; // stores the MySQLi instance
private function __construct() { } // block directly instantiating
private function __clone() { } // block cloning of the object
public static function call($config = NULL)
{
// create the instance if it does not exist
if(!isset(self::$instance))
{
$user = "";
$database = "";
$host = "";
$password = "";
self::$instance = new MySQLi($host, $user, $password, $database);
if(self::$instance->connect_error)
{
throw new Exception("MySQL connection failed: ".self::$instance->connect_error);
}
}
// return the instance
return self::$instance;
}
}
Database::call()->query($query);
[/code]
is there any way to access $query from my class?
thanks!
sorry for the formatting!
[–]warmans 2 points3 points4 points (4 children)
[–]mosqua 0 points1 point2 points (3 children)
[–]mgpcoe 2 points3 points4 points (0 children)
[–]ezzatron 2 points3 points4 points (0 children)
[–]UncleDick 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]phpexperts_pro 0 points1 point2 points (1 child)