Initially I had this error saying Call to undefined method mysqli_stmt::get_result()
Then after searching I found out that I have to enable mysqlnd driver for that. I using godaddy hosting site and I have enabled the mysqlnd driver but I am still facing the same issue. I have many function with
get_result
so solving each and one of em with bind_result
is gonna be very time consuming and hectic for me. How can I fix this issue Let's say I have this query
$stmt = $this->conn->prepare("SELECT * FROM registeration_table WHERE phone = ?");
$stmt->bind_param("s", $phone);
$stmt->execute();
$user = $stmt->get_result()->fetch_assoc();
$stmt->close();
return $user;
To resolve this error I have gone throught his link Stackoverflow link And implement this function
public function get_result($Statement) {
$RESULT = array();
$Statement->store_result();
for ( $i = 0; $i < $Statement->num_rows; $i++ ) {
$Metadata = $Statement->result_metadata();
$PARAMS = array();
while ( $Field = $Metadata->fetch_field() ) {
$PARAMS[] = &$RESULT[ $i ][ $Field->name ];
}
call_user_func_array( array( $Statement, 'bind_result' ), $PARAMS );
$Statement->fetch();
}
return $RESULT;
}
Thank you.