您好,欢迎访问一九零五行业门户网

php在计算机上运行正常在linux终端机上却不正常 求解 头疼当中

php在电脑上运行正常在linux终端机上却不正常 求解 头疼当中
我的php文件内容:
一直提示 fatal error; call to a member function query() on a non-object online 16
$db->connection->query(create table test(id integer primary key,name varchar(50),grade varchar(50),score varchar(50)));一直提示这行出错我贴在这里
我在电脑上运行是完全正常的 可以插入数据 是在linux终端机上运行时就一直提示错误 要疯了 是终端机设置的问题吗
connection->query(create table test(id integer primary key,name varchar(50),grade varchar(50),score varchar(50))); 提示这行出错
//执行插入语句
//$result = $db->query(insert into test(name,grade,score) values('.$fname.','.$fgrade.','.$fscore.'));  
$result = $db->connection->query(insert into test(name,grade,score) values('.$fname.','.$fgrade.','.$fscore.'));
//返回结果 主要是用来调试的
print_r($result);
//sqlite类
class sqlite   
{   
  function __construct($file)   
  {   
  try   
  {   
  $this->connection=new pdo('sqlite:'.$file);   
  }   
  catch(pdoexception $e)   
  {   
  try   
  {   
  $this->connection=new pdo('sqlite2:'.$file);   
  }   
  catch(pdoexception $e)   
  {   
  exit('error!');   
  }   
  }   
  }
function __destruct()   
  {   
  $this->connection=null;   
  }
function query($sql) //直接运行sql,可用于更新、删除数据   
  {   
  return $this->connection->query($sql);   
  }
function getlist($sql) //取得记录列表   
  {   
  $recordlist=array();   
  foreach($this->query($sql) as $rstmp)   
  {   
  $recordlist[]=$rstmp;   
  }   
  return $recordlist;   
  }
function execute($sql)   
  {   
  return $this->query($sql)->fetch();   
  }
function recordarray($sql)   
  {   
  return $this->query($sql)->fetchall();   
  }
其它类似信息

推荐信息