php - Call to undefined method mysqli_stmt::get_result -
here's code:
include 'conn.php'; $conn = new connection(); $query = 'select emailverified, blocked users email = ? , sla = ? , `password` = ?'; $stmt = $conn->mysqli->prepare($query); $stmt->bind_param('sss', $_post['emailid'], $_post['sla'], $_post['password']); $stmt->execute(); $result = $stmt->get_result();
i error on last line as: call undefined method mysqli_stmt::get_result()
here code conn.php:
define('server', 'localhost'); define('user', 'root'); define('pass', 'xxxx'); define('db', 'xxxx'); class connection{ /** * @var resource */ var $mysqli = null; function __construct(){ try{ if(!$this->mysqli){ $this->mysqli = new mysqli(server, user, pass, db); if(!$this->mysqli) throw new exception('could not create connection using mysqli', 'no_connection'); } } catch(exception $ex){ echo "error: ".$e->getmessage(); } } }
if write line:
if(!stmt) echo 'statement prepared'; else echo 'statement not prepared';
it prints 'statement not prepared'. if run query directly in ide replacing ? marks values, works fine. please note $conn object works fine in other queries in project.
any please.......
please read user notes method:
http://php.net/manual/en/mysqli-stmt.get-result.php
it requires mysqlnd driver... if isn't installed on webspace have work bind_result & fetch!
https://secure.php.net/manual/en/mysqli-stmt.bind-result.php
Comments
Post a Comment