What common error message might indicate an issue with a MySQL query in a PHP script?

One common error message that might indicate an issue with a MySQL query in a PHP script is "Warning: mysqli_query() expects parameter 1 to be mysqli, null given." This error typically occurs when the database connection is not properly established before executing the query. To solve this issue, make sure to establish a connection to the MySQL database using the mysqli_connect() function before executing any queries.

// Establish a connection to the MySQL database
$connection = mysqli_connect("localhost", "username", "password", "database");

// Check if the connection is successful
if (!$connection) {
    die("Connection failed: " . mysqli_connect_error());
}

// Execute a MySQL query
$query = "SELECT * FROM table_name";
$result = mysqli_query($connection, $query);

// Rest of the PHP script