Database connection query
Similar to this one: Minimalistic mysql db class

To answer your question: NO!

The short answer: Throw away your code, burn it, do whatever you want with it but never use it in a production enviroment. Just don't.

The long answer: Again, don't use this code, ever. You are even violating nearly every SOLID rule

As far as I can see you are trying to write some wrapper around the mysqli object. But the question remains: why? and what problem are you trying to solve?

As far as I can see, you are trying to solve 2 problems with one solution. Oh oh, this is doomed to fail. You want to solve the problem of always having to check wether an instance of mysqli exists or not and you want to not have to worry about connecting and creating a mysqli instance and query-ing/sanitizing the database with a given query. 3 different things.

Then you start designing the solution to that problem. When that is done, you should take a step back and ask the question 'Is my code easy to use?' and 'Is it easy configurable and extendable?' and most important 'is it easy to debug?'.

The answer to those 3 questions is simple: NO!


If you want to change a connection parameter you have to change the
code of the class itself, bad bad bad.
If something goes wrong (an exception) you echo an error message. So
what if I first get an instance of your database and it echo's some
error message, and then my code sends a header(); . Ooeehh, a nice
header allready sent error. Hf debugging that error...
...


But in fact, that isn't your real problem. The real problem you have is that you are writing code without designing it.

If your problem is that you want only one instance to exist you should only create one instance instead of relying on a get_instance() function or Singleton pattern. If a class needs a database connection, pass it in in the __construct(). More on this topic: 


http://www.slideshare.net/go_oh/singletons-in-php-why-they-are-bad-and-how-you-can-eliminate-them-from-your-applications
https://stackoverflow.com/questions/1812472/in-a-php-project-what-patterns-exist-to-store-access-and-organize-helper-objec


To sum up, sometimes the problems we are solving tend to be meta-problems. The solution we make is actually a fix. A good article on this: http://thedailywtf.com/Articles/The_Complicator_0x27_s_Gloves.aspx

On a complete diffrent note, instead of using mysqli. use PDO.
This is a realy nice OO way of using a database. more on pdo:


http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/
http://www.php.net/manual/en/class.pdo.php