找回密码
 加入
搜索
查看: 2196|回复: 4

[AU3基础] 如何获取MySQL数据表字段名称

  [复制链接]
发表于 2017-8-15 14:35:31 | 显示全部楼层 |阅读模式
获取字段内容是如下代码:
        $query1 = "SELECT * FROM test"
        _MySQL_Real_Query($MysqlConn, $query1)
        $res = _MySQL_Store_Result($MysqlConn)
        $fields = _MySQL_Num_Fields($res)
        $rows = _MySQL_Num_Rows($res)
        If $rows <> 0 Then
                $array = _MySQL_Fetch_Result_StringArray($res)
                ;$array[1][1]...................................      
        EndIf

$fields会得到test数据表字段数量,但想要获取 test 表的字段名称该怎么实现?
发表于 2017-9-7 00:19:27 | 显示全部楼层
既然连接上了MYSQL,直接运行sql获取当前表的字段就行了吧
发表于 2017-9-7 08:49:47 | 显示全部楼层
怎么连上的?
发表于 2017-9-7 16:03:06 | 显示全部楼层
select COLUMN_NAME from information_schema.COLUMNS where table_name = 'your_table_name' and table_schema = 'your_db_name';
 楼主| 发表于 2017-9-8 22:35:35 | 显示全部楼层
谢谢大家关注,已用其他方式解决~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 21:07 , Processed in 0.067566 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表