List of PHP native_type's for PDO getColumnMeta()

后端 未结 6 1261
走了就别回头了
走了就别回头了 2020-12-19 12:42

I am using the PDO Database Abstraction library to make sure my code is portable. However, I now find that I need column information so I turned to the PDOStatement->getColu

6条回答
  •  眼角桃花
    2020-12-19 13:41

    It's more work but create the database with column names like vc_20_Last_Name. Then explode the the column name on "_". Position zero contains vc or VARCHAR. Position 1 contains the column width or 20. Position 2 and above contains Last and Name which is self explanatory. You now have the possibility to write a generic function to automatically build the HTML forms for INSERT, UPDATE and DELETE operations. You could pass parameters to exclude (or include if it's easier) fields that you don't / do want to appear. Write the code once and use it for ever. Tough luck if you are stuck with someone else's tables.

提交回复
热议问题