added MySQL error to syntax error so that users might have a better idea of the issue, added headers to the CSV output
reconstructed if statements to start with true values, added better select handling for columns using strtoupper to handle any case and add a case for empty select list which does select * if none is given