Well...the question pretty much says everything, i have a database and i need to count how many rows it has(it represents the number of registered users) and i have to show it in html. it shows me this error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\LGCM\wp-content\themes\Avada-Child-Theme\home.php on line 381
i tried some stuff but i got a bunch of errors(i'm kind of new in this):
<?php
$db = mysql_connect('localhost','root','','lgcm_new');
$result = mysql_query("SELECT COUNT(id) AS 'total' FROM wp_users");
$row = mysql_fetch_assoc($result);
$size = $row['total'];
?>
What am i doing wrong? i Just need to show how many user we have in our database, that's all i need.
The awnser was to use the msqli library(Given by use Ghost): query("SELECT COUNT(id) AS total FROM wp_users"); $result = $query->fetch_assoc(); echo $result['total']; ?>