Home >Database >Mysql Tutorial >mysql-Mysql中如何获取一条数据中所有字段的名称和值

mysql-Mysql中如何获取一条数据中所有字段的名称和值

WBOY
WBOYOriginal
2016-06-06 09:38:511824browse

mysql

有一个表User, 有字段id, name, password, mobile.
现在要获取User表中id=1的所有字段的名称保存为'key',其对应的值为'value'

例如有表中一条记录:
id name password mobile
1 test 123 138100138000

现在要获取这一条记录并保存为

key value
id 1
name test
password 123
mobile 13800138000

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn