I am not sure if I am supposed to use SUM() for this, but I wanted to get the sum of all the values in the "earnedcoins" column and this is my code:
$sql = "SELECT SUM(earnedcoins) FROM users";
$result = mysqli_query($conn, $sql);
$earnedcoins = mysqli_num_rows($result);
echo $earnedcoins;
$conn->close();
Unfortunately, it just stamps out number 1. Can anybody help me resolve this issue? Any help will be appreciated.