Fully commented query.php
Added error_object method
Renamed functions to be more consistent with PHP
Wrapped functions in a class for better organization