I just migrated my website from PHP 7.4 to 8.0 which using cPanel (and yes, 8.1 is in release candidate now). After the migration, I notice my navigation bar and footer is not rendered. Here is a PHP script:
When I go to the PHP script site, it throw an error like this:
“Uncaught Error: Call to undefined method mysqli_stmt::get_result()”
(line 33 in navbar_footer.php)
And solved by replacing “get_result()” to store and bind result in the statement object (and luckily that only one file need to be modified):
However, PHP documentation said it supported PHP 8 here:
In theory, I can convert to PHP 8 without modify my code from PHP 7.4 since it said supported. But I searched and find a bunch of tutorials of fixing this error which released before the date of releasing PHP 8’s first version. It is confirmed that this method suppose should be defined but not with unknown reason. If this method is going to deprecated, why I can’t find any related content in the documentations?
In conclusion, “mysqli_stmt::get_result()” with unknown availability causing my website crashed. It should be have a better explanation on installing and using this method. Otherwise, just like me replacing an alternative code which proofed it worked.