I would like to count all rows in all tables, within a MySQL database. I am aware of the InnoDB issue. I would also like to point out that the connection to the database is perfectly fine, I am simply omitting that code as I deem it irrelevant to my issue.
Here is my code:
$sql = mysqli_query($c, "SELECT SUM(TABLE_ROWS)
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'cpus_amd'");
I'm then echoing the figure using PHP echo
like so:
echo "<p>This database contains". $sql ."processors.</p>";
And I'm receiving the following error in an error_log
file:
PHP Catchable fatal error: Object of class mysqli_result could not be converted to
string in <file> on <line>
I have read through the following questions, but I'm still confused and haven't directly found a solution:
- Get record counts for all tables in MySQL database
- Object of class mysqli_result could not be converted to string in
Thank you for any help.