Ok.. constructive criticism here... not trolling...
A) Not a class. Who writes non-oop PHP anymore? B) Globals. Seriously? What if I need 2 connections in a page load? This won't work. C) Use PDO.
I see the value of the exercise, and I applaude you for it, but PDO has TRILLIONS of sql queries under its belt.
You should use PDO.