创建一个通用函数,用于从db(SQLI)中选择php

时间:2017-10-11 20:44:25

标签: php mysqli

我有这段代码,但无法执行 它说Call to undefined method Dbh::query() 可以做些什么来解决这个问题在php中的一个菜鸟刚开始可以请一些人帮忙 我也在使用mysqli

public function setSingleSelect($whatColumn,$tableName, $whereColumn,$queryCondition,$setColumn)
{
     $this->whatColumn = $whatColumn;
     $this->tableName = $tableName;
     $this->whereColumn = $whereColumn;
     $this->queryCondition = $queryCondition;
     $this->setColumn = $setColumn;
}
 public function singleSelect (){

   $sql ="SELECT {$this->whatColumn} FROM {$this->tableName}";
   $result = $conn->query($sql);

    return $result;
 }

0 个答案:

没有答案