php获取字段名示例分享

<?php
$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;