当前位置:Gxlcms > PHP教程 > php获取字段名示例分享_PHP教程

php获取字段名示例分享_PHP教程

时间:2021-07-01 10:21:17 帮助过:10人阅读

代码如下:
$link = mysql_connect('localhost', 'username', 'password');
$fields = mysql_list_fields("database", "table", $link);
$columns = mysql_num_fields($fields);
$field = false;
for ($i = 0; $i < $columns; $i++) {
$field .= "'".mysql_field_name($fields, $i) . "',";
}
print $field;

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/736820.htmlTechArticle 代码如下:

?php $link = mysql_connect('localhost', 'username', 'password'); $fields = mysql_list_fields("database", "table", $link); $columns = mysql_num_fields($fi...

人气教程排行