0

seems like there is some kind of error in get_result() in prepared statement. the below function was working perfectly fine until 2 days ago. Can anyone please help me to find whats the problem with the below function.

class userDetails{
    public function searchUser($conn){
        $userList = [];
        $user = '%fernan%';
        $query = $conn->prepare("SELECT username FROM users WHERE lastName LIKE ? ");
        $query->bind_param('s',$user);
        $query->execute();
        $getResult = $query->get_result();
        if($getResult->num_rows > 0){
            while($names = $getResult->fetch_assoc()){
                $userList[] = $names['username'];
            }
        }
        return $userList;
    }
}

it throws HTTP ERROR 500. my php current Version 5.4.45 and below is the error it give.. PHP Fatal error: Call to undefined method mysqli_stmt::get_result() Thanks in advance.

Francisco
  • 53
  • 7
  • 1
    Possible duplicate of [Call to undefined method mysqli\_stmt::get\_result](https://stackoverflow.com/questions/8321096/call-to-undefined-method-mysqli-stmtget-result) – iainn Jun 09 '18 at 08:37
  • Hi, thanks but why suddenly it stopped working 2 days ago. i have been using this for last 2 years without error. this is big headache for me now. i have to change to bind_result for thousands statements for my client website. – Francisco Jun 09 '18 at 09:07
  • Did your hosting provider update PHP perhaps? – Dave Jun 09 '18 at 10:58
  • Hi Dave, i guess thats what happened. is there a quick and simple way to fix this issue Thanks. – Francisco Jun 09 '18 at 11:04

0 Answers0