How would you check in php that a string is a valid compatible column name for a sql statement? just a string match.
Use
Either use show columns or describe query. and than validate from the result.