fix get column name method

This commit is contained in:
wlx 2015-01-16 13:50:07 +00:00
parent d0296933d9
commit 7d5b37236c
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,8 @@ class DataTableControl extends Database{
public function readFields($tableName) public function readFields($tableName)
{ {
$sql = "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='$tableName'"; $st=explode('.',$tablename);
$sql = "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where table_schema='".$st[0]."' and TABLE_NAME='".$st[1]."'";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
return $rs->fetchAll(\PDO::FETCH_COLUMN); return $rs->fetchAll(\PDO::FETCH_COLUMN);
} }