我的查询类在客户端新服务器上不起作用,因为他们的服务器缺少 mysqlnd 驱动程序。我如何将方法转换为不使用 mysqlnd 并且不搞砸他们所有的类?
function query($query, $params=NULL) {
if($params!=NULL) {
$stmt = $this->mysqli->prepare($query);
//must turn $params into reference array to bind
$ref = array();
foreach ($params as $key => $value) {
$ref[$key] = &$params[$key];
}
call_user_func_array(array($stmt,'bind_param'),$ref);
$stmt->execute();
$result = $stmt->get_result();
} else {
$result = $this->mysqli->query($query);
}
if($result){
$rowArray = array();
while ($myrow = $result->fetch_object()) {
$rowArray[] = $myrow;
}
return $rowArray;
}
return false;
}