How do i find how many items there are per unique user in a data base
So say i have hats gloves and lots of other elements in my data base that users have added
how would i find how much each one had
e.g. hats- 35 t-shirts -50
but the problem is the categories would change so it would have to get all the categories then do an MySQL search on each of them... i have done lots of different MySQL tries and they have all failed here is one
$sql = "SELECT COUNT(username) FROM cards GROUP BY username";
$query = mysqli_query($db_conx, $sql);
$row = mysqli_fetch_row($query);
$users = $row[0];
and i dont know where to go from here