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!