Php 如何正确替换get_result()函数
我在我的php文件中使用了类似的函数,但主机没有mysqlnd 那么,如何正确地替换Php 如何正确替换get_result()函数,php,mysqlnd,Php,Mysqlnd,我在我的php文件中使用了类似的函数,但主机没有mysqlnd 那么,如何正确地替换get\u result()函数呢 我已经看到了一个解决方案,但是没有实现它,所以请给我一个例子。谢谢 public function getFromDb($tableName) { $stmt = $this->conn->prepare("SELECT * FROM ".$tableName); $stmt->execute(); $result= $stmt->
get\u result()
函数呢
我已经看到了一个解决方案,但是没有实现它,所以请给我一个例子。谢谢
public function getFromDb($tableName) {
$stmt = $this->conn->prepare("SELECT * FROM ".$tableName);
$stmt->execute();
$result= $stmt->get_result();
$stmt->close();
return $result;
}
MySQLiprepare()。因此,您的函数可能如下所示:
public function getFromDb($tableName) {
$result = $this->conn->query("SELECT * FROM ".$tableName);
if (empty($result)) {
return FALSE;
}
return $result->fetch_assoc();
}
替换为什么?语法和格式任何alternative@DerVO