It will return six information for each table attribute (column).
Field, Type, Null, Key, Default, Extra
<?php
//include your DB connection
$query = "describe your_table_name";
$result = mysql_query($query);
//loop through each table column attribute
while($data = mysql_fetch_array($result))
{
echo $data['Field'].', '; //field name
echo $data['Type'].', ';//feild type
echo $data['Null'].', ';// null or not
echo $data['Key'].', ';//primary key or not
echo $data['Default'].', ';//default value
echo $data['Extra'];// like auto increment
echo '<br />';
}
?>
No comments:
Post a Comment