如何在SQLITE 2表中打印列列表?

时间:2016-04-27 09:33:04

标签: php sqlite2

在mysql类中我有这个方法来打印列列表

public function printMemberColumns(){
  $n=-1;
  foreach (explode(',',CONFIG::tables) as $tab):
    $n++;
    $result = mysql_query( "SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME`='$tab' AND `TABLE_SCHEMA`='".MYSQL::BASE."'");    
    while ( $data = mysql_fetch_row($result) )
      echo $data[0];
  endforeach;
  }

如何使用sqlite更改它?

我希望这样的东西,但它说这些表不存在:

public function printMemberColumns(){
  $n=-1;
  foreach (explode(',',CONFIG::tables) as $tab):
    $n++;
    $result = sqlite_query( $this->handle, "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='$tab' AND TABLE_SCHEMA='".SQLITE::BASE."'");    
    while ( $data = sqlite_fetch_array($result) )
      echo $data[0];
  endforeach;
  }

我没有使用PDO而且我使用的是PHP 5.2.0

0 个答案:

没有答案