(Note: I don't use MySQL, so you might need to protect the identifiers with ` in that statement.)
I've been toying with the idea of creating something like select_function($function, $args), and maybe a more generic *_function($fname, $args, ...) (where * is where, like, etc). But there needs to be some work on the idea yet, like how to distinguish between string args and column names.