Fixing a bug with ini_set and various SQL syntax errors