mysqli_stmt::get_result() is available in PHP 8; PHP 8 did not remove it. The PHP Manual says the method is “Available only with mysqlnd.” If PHP 7.4 worked but a PHP 8 web request reports the method as undefined, check the MySQLi driver support in the PHP runtime handling that request. The error alone does not prove which configuration is responsible.
Why can PHP 7.4 work while PHP 8 says the method is undefined?
The method’s presence depends on the MySQLi runtime and its driver support, not simply on whether the PHP version is 7.4 or 8. The PHP Manual entry for mysqli_stmt::get_result() lists it for PHP 7 and PHP 8 and specifies the mysqlnd requirement.
In the SitePoint thread behind this symptom, the poster said a prepared query worked under PHP 7.4 and failed at $stmt->get_result() after switching to PHP 8 through cPanel. The accepted response attributed the difference to the PHP 8 build selected there. The thread does not include runtime configuration output, so that is a reported explanation, not a verified diagnosis of the account.
What to check in the failing web request
- Confirm the PHP runtime serving the page. Check with your hosting provider or a temporary, access-controlled diagnostic page served through the same website and PHP handler as the failing code. A command-line PHP configuration or a different cPanel selector may describe another runtime.
- Check the MySQLi extension and client driver. Ask whether the selected PHP 8 runtime has MySQLi with mysqlnd support. The PHP Manual documents that support as the condition for using
get_result(). - Remove diagnostic output after checking. Do not leave a publicly accessible configuration page in place; it can expose server details.
- Ask the host to confirm available configuration options. If mysqlnd support is absent, ask whether it can be enabled or whether a PHP 8 build with the required MySQLi support is available.
For this specific SitePoint report, the PHP 8 build, loaded extensions, active web SAPI, and driver were never published. The forum discussion, opened January 6, 2022 and last replied to January 9, 2022, cannot establish the current configuration of that account or other hosts.
#1 Best Overall
Choose a remedy
| Option | What changes | Trade-off |
|---|---|---|
| Use MySQLi with mysqlnd support | Have the provider check or supply a PHP 8 web runtime whose MySQLi extension supports mysqlnd; the query’s result-reading code may not need to change. | Depends on the host’s available PHP configuration. |
| Keep MySQLi and bind result columns | Replace get_result() result handling with prepared-statement result metadata and mysqli_stmt_fetch(). See the PHP Manual on binding prepared-statement results. |
Keeps the MySQLi API but uses a more explicit, potentially more verbose fetch workflow. |
| Migrate the query to PDO | Use PDO to prepare the statement, execute it with the input parameter, and fetch the row. See the PHP Manual on prepared statements. | This is an API migration, not a one-line replacement. Review connection setup, error handling, fetch mode, and downstream result use. |
Distinguish this fatal error from result-handling errors
An undefined-method error means the current mysqli_stmt object does not expose get_result() in that runtime. It is different from calling an available method on a statement that does not produce rows. The PHP Manual says successful SELECT, SHOW, DESCRIBE, and EXPLAIN operations return a mysqli_result; for other successful statements, get_result() returns false. It also says not to combine get_result() with mysqli_stmt_store_result(), because both retrieve the full result set.
Those result rules matter after the runtime exposes the method. They do not explain an undefined-method fatal error.
Rank #2
Why a syntax checker may not catch it
A syntax check can confirm that code parses without proving that the web runtime provides every method used by an object. Because get_result() is conditional on MySQLi driver support, verify the actual runtime serving the request rather than treating a successful syntax check as evidence that the method is available.
Quick Recap
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




