★ wanayoo — archive 1999 http://fr.php.net/manual/function.mysql-list-fields.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to MySQL
Quick Reference
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this pageDutch version of this pageBrazilian Portuguese version of this page
Korean version of this pageCzech version of this page
MySQL
* mysql_affected_rows
* mysql_change_user
* mysql_close
* mysql_connect
* mysql_create_db
* mysql_data_seek
* mysql_db_name
* mysql_db_query
* mysql_drop_db
* mysql_errno
* mysql_error
* mysql_fetch_array
* mysql_fetch_assoc
* mysql_fetch_field
* mysql_fetch_lengths
* mysql_fetch_object
* mysql_fetch_row
* mysql_field_flags
* mysql_field_name
* mysql_field_len
* mysql_field_seek
* mysql_field_table
* mysql_field_type
* mysql_free_result
* mysql_insert_id
* mysql_list_dbs
* mysql_list_fields
* mysql_list_tables
* mysql_num_fields
* mysql_num_rows
* mysql_pconnect
* mysql_query
* mysql_result
* mysql_select_db
* mysql_tablename

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: mysql_list_fields
View the source code for this pageSearch the site



Previous page
 mysql_list_dbs
 Updated
Mon, 08 Jan 2001
mysql_list_tables 
Next page


mysql_list_fields

(PHP 3, PHP 4 )

mysql_list_fields -- List MySQL result fields

Description

int mysql_list_fields (string database_name, string table_name [, int 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().

A result identifier is a positive integer. The function returns -1 if a error occurs. A string describing the error will be placed in $phperrmsg, and unless the function was called as @mysql() then this error string will also be printed out.

Example 1. mysql_list_fields() example


$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.


 About Notes


Previous page
 mysql_list_dbs
 Updated
Mon, 08 Jan 2001
mysql_list_tables 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
France
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.