I am writing a code for live searching a record with query passed by user. The following is code written:
if(isset($_REQUEST["term"])){
$sql = "SELECT * FROM students WHERE rollno LIKE ?";
if($stmt = $conn->prepare($sql)){
$stmt->bind_param("s", $param_term);
$param_term = $_REQUEST["term"] . '%';
if($stmt->execute()){
$result = $stmt->get_result(); // error on this line
if($result->num_rows > 0){
// Fetch result rows as an associative array
while($row = $result->fetch_array(MYSQLI_ASSOC)){
$rollno = $row['rollno'];
$name = $row['name'];
$image = $row['image'];
echo $rollno." ".$name." ".$image;
}
}
}
}
}
the code works fine on thew local server. But the same code does not work on the live server with same database. I am getting an error Fatal error: Call to undefined method mysqli_stmt::get_result() in /home/u687417727/public_html/digiclass/panel/backend-search.php on line 25
right after I enter some query. I have shown the error in the code with comment. What could be the problem? Help please. Trying to evaluate it from long time.