Custom Query Builder Returning Error MySQL/PHP