Is possible to count some value from rows in mysql and write it in PHP?
Example:
Username Damage
|------------|------------|
| user123 | 325 |
| user356 | 6634 |
| user426 | 422 |
| user993 | 92 |
| user183 | 4235 |
How I need to have all damage in one, example in PHP: <? echo "$alldamage"; ?>
But I don't know MySQL command or some PHP vars. to do that, if you can help me this will be very appreciated!
You are looking for SUM()
which adds all the rows you specify
SELECT SUM(Damage) AS alldamage FROM your_table_name GROUP BY something;
Since i don't know the entire table, i can't give you more information, but this is your way to go
If you want all damage values with MySQL, you can use the SUM function
With PHP you can use foreach for each line and count/sum like:
...
$count = $count + $result['damage']; // my column from MySQL
...
use select username AS USERNAME,count(damage) AS ALLDAMAGE from table group by username