Home > php教程 > php手册 > 获得数据表的字段名

获得数据表的字段名

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:33:06
Original
835 people have browsed it

php.net 无 ?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_fiel

php.net
<?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;
Copy after login
Related labels:
Statement of this Website
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
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template