2010-02-01 42 views

回答

2

你想和Show Columns组合Show Tables

+0

我们如何能结合他们两个 – KoolKabin 2010-05-24 09:59:49

+0

@Kool卡宾 - 通过使用2个单独的查询 - 不能将它们(据我所知)组合成单个查询 – 2010-05-24 12:17:37

0

这将返回领域

//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; 
} 
相关问题