简体   繁体   English

在mysql pdo中获取受影响的行的列名?

[英]fetch column name of affected rows in mysql pdo?

I am running an update query using PDO. 我正在使用PDO运行更新查询。 I am updating only four rows but I do not know the names of columns. 我仅更新四行,但不知道列名。 I can easily get the count of rows using rowCount() but I also want to fetch the column name as well. 我可以使用rowCount()轻松获取行数,但我也想获取列名。 Is there any function in PDO which will help for the same? PDO中是否有任何功能可以帮助您? If not then please tell me the other method for fetching this. 如果没有,请告诉我另一种获取方法。

You don't need PDO, you can get the names with MySQL: 您不需要PDO,可以使用MySQL获得名称:

SHOW COLUMNS FROM `table`

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM