Home » » mysql_list_fields

mysql_list_fields

Written By 1 on Sunday, September 30, 2012 | 7:20 PM

resource mysql_list_fields ( string $database_name , string $table_name [, resource $link_identifier = NULL ] )

List MySQL table fields

Retrieves information about the given table name.


<?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);
    }
}
?>


PHP Tutorial - Alternate to deprecated mysql_list_fields()

0 Comment:

Post a Comment