简体   繁体   中英

Error While Fetching Rows From mysql PHP

I have the following code running on PHP server, but I am stuck with following issue

$stmt = $this->conn->prepare("SELECT * FROM vehicle_model");
$stmt->execute();
//grab a result set
$resultSet = $stmt->get_result();
//pull all results as an associative array
$result = $resultSet->fetch_all();
$stmt->close();
return $result;

I have created the connection like below

new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);

I am having PHP version 5.5.9 and Server type: MySQL

Error:

[Mon Apr 11 19:33:46.033855 2016] [:error] [pid 10259] [client 223.190.77.90:50531] PHP Fatal error: Call to undefined method mysqli_stmt::get_result() in /var/www/html/include/VehicleModelHandler.php on line 19

I am stuck for almost 2 hours if any one can point out what is happening wrong that would be a great help.

Document clearly explains how to use $stmt function..

please refer this: http://php.net/manual/en/mysqli-stmt.get-result.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM