php获取字段名示例分享_PHP
程序员文章站
2022-05-23 08:29:51
...
复制代码 代码如下:
$link = mysql_connect('localhost', 'username', 'password');
$fields = mysql_list_fields("database", "table", $link);
$columns = mysql_num_fields($fields);
$field = false;
for ($i = 0; $i $field .= "'".mysql_field_name($fields, $i) . "',";
}
print $field;
$link = mysql_connect('localhost', 'username', 'password');
$fields = mysql_list_fields("database", "table", $link);
$columns = mysql_num_fields($fields);
$field = false;
for ($i = 0; $i $field .= "'".mysql_field_name($fields, $i) . "',";
}
print $field;
下一篇: 如何编写一个独立的PHP扩展_PHP教程