Toms Homepage
  Home    Downloads    Your Account    Forums  
  Create an account
Modules
· Home
· Games
· My Gallery
· PHP Manual
· PHP-Nuke HOWTO
· Web Links
· Your Account
 
Who's Online
Welcome, Anonymous
Nickname

Password

Security Code
Security Code
Type Security Code


(Register)

Membership:
Latest: LorenaNai
New Today: 275
New Yesterday: 617
Overall: 43745

People Online:
Visitors: 76
Members: 15
Total: 91

Online Now:
COM AshliMelt
COM ChetPoe
COM LilyDecke
 MyrnaI63
COM BertieShe
COM BeckyIGL
COM FinlayHut
COM StanleyCo
 Kristine2
COM XKXRobby
COM TammaraMc
COM PeteLayma
Poland FannyMccl
COM KathyIrwi
COM Franklyn0
 
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] )

Note: 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.

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().

Example 1. Alternate to deprecated mysql_list_fields()

<?php
$result
= mysql_query("SHOW COLUMNS FROM sometable");
if (!
$result) {
    echo
'Could not run query: ' . mysql_error();
    exit;
}
if (
mysql_num_rows($result) > 0) {
    while (
$row = mysql_fetch_assoc($result)) {
        
print_r($row);
    }
}
?>

The above example would produce output similar to:

Array
(
    [Field] => id
    [Type] => int(7)
    [Null] =>
    [Key] => PRI
    [Default] =>
    [Extra] => auto_increment
)
Array
(
    [Field] => email
    [Type] => varchar(100)
    [Null] =>
    [Key] =>
    [Default] =>
    [Extra] =>
)


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

See also mysql_field_flags() and mysql_info().

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2004 by Tom Nitzschner.
Web site engine code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.097 Seconds

:: VereorLCARS phpbb2 style by Vereor :: PHP-Nuke theme by www.nukemods.com ::