Comunitatea PHP Romania
 

 
mysql_list_fields

mysql_list_fields

(PHP 3, PHP 4 , PHP 5)

mysql_list_fields -- List MySQL table fields

Description

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

mysql_list_fields() retrieves information about the given table name. Arguments are the database 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().

Exemplu 1. mysql_list_fields() example

<?php
$link
= mysql_connect('localhost', 'mysql_user', 'mysql_password');

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

Notã: The function mysql_list_fields() is deprecated. It is preferable to use mysql_query() to issue a SQL SHOW COLUMNS FROM table [LIKE 'name'] Statement instead.

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Top membri

Pirahna Pirahna
la birou
carco carco
Bucuresti
Birkoff Birkoff
Bucuresti
mihaitha mihaitha
Sibiu
Mascka Mascka
Braila
gabysolomon gabysolomon
Bacau
whooper whooper
Toronto ON
raul_ raul_
dechim dechim
Drobeta Turnu Severin
Amenthes Amenthes

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Credit Card | Credit Card | Debt Consolidation | San Diego Sports Tickets | Car Credit
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis