"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > 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?

Posted on 2025-03-22
Browse:931

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
Release Statement This article is reproduced on: 1729399396 If there is any infringement, please contact [email protected] to delete it.
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3