October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

PHP 8: Fixing “Call to undefined method mysqli_stmt::get_result()”

PHP 8 did not remove mysqli_stmt::get_result(). The method requires mysqlnd support in the MySQLi runtime serving the request.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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

  1. 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.
  2. 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().
  3. Remove diagnostic output after checking. Do not leave a publicly accessible configuration page in place; it can expose server details.
  4. 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.