I have my app build in localhost with MySQL prepare statement as following:
include('db.php');
$stmt = $mysqli->prepare("SELECT * FROM `hero` WHERE name=? LIMIT 1") or die($mysqli->error);
$stmt->bind_param('s', $name);
$name = 'superman';
$stmt->execute();
$check = $stmt->get_result();
$rows = $check->fetch_object();
$num = $check->num_rows;
if($num == 0){
echo 'Failed!';
}else{
echo 'Found!';
}
The query is working fine in localhost, when I tested in web hosting there is an error shown:
Fatal error: Call to undefined method mysqli_stmt::get_result()...
After some web research, the catch was it was caused by mysqld
driver not being installed in hosting (PHP version 5.4++, I reckon 5.3 onwards are already available?).
Is there any workaround to using an alternate way instead of mysqli_stmt::get_result
?