• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Actual Wizard

Actual Wizard

Great Content From Actual Wizards

  • Blogging
  • Programming
  • Social Media
  • Marketing
You are here: Home / Programming

Fatal error: Call to undefined function mysql_query() – Solved

November 16, 2020 by Kevin Marszalek

If after upgrading PHP or while working on a programming project, you have encountered the following error:

Fatal error: Call to undefined function mysql_query()

The best solution is most likely to use mysqli_query() instead.

Simple MySQLI Example:

$mysqli_connection = new mysqli("localhost", "user", "password", "database");
$result = $mysqli_connection->query("SELECT id FROM test ORDER BY id ASC");
$mysqli_connection->close();

Why Doesn’t mysql_query() Work in PHP 7?

PHP has historically offered two different extensions for connecting to and communicating with a MySQL database, (these extensions being called MySQL and MySQLI.)

As of PHP 7.0, mysql_query() has been removed as it has been depreciated since 5.5.0.

Note: If you cannot use MySQLI because you do not have the ability to update the application’s code, you will have to downgrade the version of PHP that your server is using.

Filed Under: Programming

Read More From Actual Wizard

  • Understanding the Different Parts of an Email Address
    An email address has four parts; the recipient name, the @ symbol, the domain name, and the top-level domain. …
  • How to Get the Last Element of an Array in JavaScript
    There are a number of different ways to get the last element of an array in JavaScript. Below we will explore …
  • How to use document.write() in JavaScript
    How to use document.write() in JavaScript The document.write() function is commonly used when testing simple …
  • How to Open a New Tab with JavaScript
    Opening a new browser window in a new tab can be done easily in JavaScript. Modern web browsers provide a …

Primary Sidebar

More posts from this section

  • How to Get the Last Element of an Array in JavaScript
  • How to use document.write() in JavaScript
  • How to Open a New Tab with JavaScript
  • PX to EM Converter – Online CSS Font Size Tool
  • How to Hide the URL Address in the Browser Status Bar
  • Heart Symbol HTML Code with Examples
  • HTML Trademark Symbol Code Example
  • Prevent a Phone Number from Wrapping to a New Line in CSS HTML
  • Html Tutorial Hello World Example with Code
  • Force a File to Download Instead of Opening it in a Browser with HTML

Copyright © 2025 ActualWizard.com

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy