Description

This function is deprecated. It is preferable to use
mysql_query() to issue an SQL SHOW COLUMNS FROM
table [LIKE 'name'] statement instead.

Parameters

database_name

The name of the database that's being queried.

table_name

The name of the table that's being queried.

link_identifier

The MySQL connection. If the
link identifier is not specified, the last link opened by
mysql_connect() is assumed. If no such link is found, it
will try to create one as if mysql_connect() had been called
with no arguments. If no connection is found or established, an
E_WARNING level error is generated.

// Returns a bunch of information about a table...// The name of the auto-increment field, if any, fields in the// primary key (using the function above), and all information// about all fields.function getTableInformationOf($table) {$information = array("auto" => "","primary" => array(),"fields" => array() );

Every my html table output begins with heading row containing the field names. For that purpose I accepted the short combination of MySQL function, giving me a result similar to the mysql_fetch_array() for the row of values. The following example shows the basic idea. It should be adapted for the specific use:

The advantage of this is, that it gives the names of the result, neither the field names of the whole table. Please read the discussion about duplicate field names in SQL result carefully. The use, as shown in the example above, increments the pointer, hence some regular function, which does not, could be more useful :-)