Документ взят из кэша поисковой машины. Адрес оригинального документа : http://oit.cmc.msu.ru/php/function.mysql-list-fields.html
Дата изменения: Sun Feb 3 22:47:35 2002
Дата индексирования: Mon Oct 1 22:07:26 2012
Кодировка:
mysql_list_fields

mysql_list_fields

(PHP 3 <= 3.0.18, PHP 4 >= 4.0.0)

mysql_list_fields -- List MySQL result fields

Description

resource mysql_list_fields ( string database_name, string table_name [, resource link_identifier])

mysql_list_fields() retrieves information about the given tablename. Arguments are the database name and the table name. A result pointer is returned which can be used with mysql_field_flags(), mysql_field_len(), mysql_field_name(), and mysql_field_type().

Example 1. mysql_list_fields() example

<?php
$link = mysql_connect('localhost', 'myname', 'secret');

$fields = mysql_list_fields("database1", "table1", $link);
$columns = mysql_num_fields($fields);

for ($i = 0; $i < $columns; $i++) {
    echo mysql_field_name($fields, $i) . "\n";;
}

The above example would produce the following output:
field1
field2
field3
...

For downward compatibility mysql_listfields() can also be used. This is deprecated however.