0
I made this code so that a count of the number of comments was performed, and returned the value of how many comments there were in the post. But instead of just returning the value, it’s returning this:
Array ( [COUNT(*)] => 9 )
//Commentary
How do I return only the 9 instead of Array
( [COUNT(*)] => 9
) ?
<?php
$query = mysql_query("SELECT COUNT(*) FROM comentario");
$linhas = mysql_fetch_assoc($query);
?>
<h4 class="mb-30"><?php print_r ($linhas); ?> Comentários</h4>
Thank you!! It worked
– Athena
@Athena benefits from starting and not using the old php api for mysql, it has been removed in PHP7 and its codes will fail in this version, switch to the more modern API like mysqli or PDO, read more on: https://answall.com/q/579/3635 --- PS: the database remains mysql, only the communication API has changed ;)
– Guilherme Nascimento