Benim mysql veritabanındaki tüm tabloları listelemek istiyorum.
Ben istiyorum sütun adı ve veri türü ile her tablo liste.
Peki nasıl ben, herhangi bir sorgu veya böyle bir şey yapabiliriz.
Php Running on
Teşekkürler
Avinash
Bu alanları dönecektir
//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;
}