Home  >  Article  >  Backend Development  >  How to Fix \"count(): Parameter Must be an Array or an Object Implementing Countable\" Error in phpMyAdmin?

How to Fix \"count(): Parameter Must be an Array or an Object Implementing Countable\" Error in phpMyAdmin?

DDD
DDDOriginal
2024-10-20 12:57:30698browse

How to Fix

Count(): Parameter Must be an Array or an Object Implementing Countable

Issue:

When opening a table in phpMyAdmin, users encounter a warning: "count(): Parameter must be an array or an object that implements Countable."

Background:

The issue stems from a function in the sql.lib.php library, where the count() function is called with an incorrect parameter.

Resolution:

To resolve the issue, edit the sql.lib.php file using the command:

sudo nano +613 /usr/share/phpmyadmin/libraries/sql.lib.php

On line 613, replace the following code:

((empty($analyzed_sql_results['select_expr']))
    || (count($analyzed_sql_results['select_expr'] == 1)
        && ($analyzed_sql_results['select_expr'][0] == '*')))

With this code:

((empty($analyzed_sql_results['select_expr']))
    || (count($analyzed_sql_results['select_expr']) == 1)
        && ($analyzed_sql_results['select_expr'][0] == '*'))

Additionally, delete the last closing parenthesis on line 614.

Restart the web server:

sudo service apache2 restart

The above is the detailed content of How to Fix \"count(): Parameter Must be an Array or an Object Implementing Countable\" Error in phpMyAdmin?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn