Check for valid SQL column name

后端 未结 4 1524
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-15 16:59

How would you check in php that a string is a valid compatible column name for a sql statement? just a string match.

4条回答
  •  太阳男子
    2020-12-15 17:38

    If i'd had the same question, I'd search particular database documentation for the certain character list and then implement it in the form of regexp.

    But I would never face such a question because basic latin characters, numbers and underscore are more than enough to name any field I use. So I'd keep great portability and maintainability.

提交回复
热议问题