Hi
I want to list all tables in my mysql database.
I want that each table list with column name and datatype.
So how could i do this, any query or something like that.
Running on php
Thanks
Avinash
Hi
I want to list all tables in my mysql database.
I want that each table list with column name and datatype.
So how could i do this, any query or something like that.
Running on php
Thanks
Avinash
This will return fields
//Get fields function
public function getFields($tmptable){
$fields = array();
$result = mysql_query("SHOW COLUMNS FROM ". $tmptable);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
//populate num of fields
//$this->num_fields = mysql_num_rows($result);
if ($this->num_fields($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
//polulate fields list
foreach ($row as $field){
$fields[] = $field;
if($field['key'] == "PRI"){
//$this->primary_key_field = $field;
}
}
}
}
return $fields;
}