PHP未定义方法mysqli_stmt :: get_results()[复制]

This question already has an answer here:

On backend I have rest api and I call v1/task with ajax to get all user tasks

I have:

public function getAllUserTasks($user_id) {
        $stmt = $this->conn->prepare("SELECT t.* FROM tasks t, user_tasks ut WHERE t.id = ut.task_id AND ut.user_id = ?");
        $stmt->bind_param("i", $user_id);
        $stmt->execute();
        $tasks = $stmt->get_results();
        $stmt->close();
        return $tasks;
    }

but I got error:

<br />
<b>Fatal error</b>:  Call to undefined method mysqli_stmt::get_results() in <b>/home/agroagro/public_html/agroMobile/include/DbHandler.php</b> on line <b>281</b><br />

Here is my console screen: enter image description here

How I can solv ethis problem? Any replacment for this function?

</div>

I think small mistake in your function

$tasks = $stmt->get_results();

it should be

$tasks = $stmt->get_result();

Or try by this way

$stmt->bind_result();
$tasks = $stmt->fetch();