Kitkat Posted May 21, 2009 Share Posted May 21, 2009 Hello again.. I'm building an infractions system (similar to most forum "warn" systems) and I want to actually count up the values of each row. I'm not exactly sure to do that. So for instance say we had this: `id`, `userid`, `infractamount` And I pulled the rows `1`, `5`, `2` `2`, `5`, `3` Is there any way I can add those up to 5 from ONE QUERY? I know very well how to do it out of MySQL but I would like to know if there's a shortcut. Link to comment https://forums.phpfreaks.com/topic/159093-another-question-counting-values-of-rows-in-a-database/ Share on other sites More sharing options...
MasterACE14 Posted May 21, 2009 Share Posted May 21, 2009 can use a SELECT query and mysql_num_rows(); Link to comment https://forums.phpfreaks.com/topic/159093-another-question-counting-values-of-rows-in-a-database/#findComment-838982 Share on other sites More sharing options...
Kitkat Posted May 21, 2009 Author Share Posted May 21, 2009 No, I don't want to count the rows, I want to add up all the values inside the rows in a particular column. Link to comment https://forums.phpfreaks.com/topic/159093-another-question-counting-values-of-rows-in-a-database/#findComment-839051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.