changed order of functions, added check for one input to mysql query function, issue #27