I know how to count number of values in a row, using something such as:
$num = mysql_query("SELECT COUNT(rowName) FROM tableName");
but I have a table that contains rows that have columns that organize the type the row is. Such as a column in one of the rows is: 'otherType' which can vary in between three different values. How can I count each different value?
Basically, I want to be able to count 'otherType->Character', 'otherType->Entity', 'otherType->Item'.
Is this possible?
Sorry..I'm not so good at explaining.
EDIT:
So, my table looks like this:
id | forGame | otherType | otherDesc
1 | ... | Entity | ...
2 | ... | Item | ...
3 | ... | Character | ...
I want to be able to count how many of 'Entity', how many of 'Item', how many of 'Character'..is there a way to do that?
It would be preferable to be able to have variables such as:
$numEntities = [query]
$numItems = [query]
$numCharacters = [query]
or otherwise how might I get the count of just one at a time?
mysql_query("SELECT COUNT(otherType),otherType FROM mainSite_others group by otherType")
works fine, but how do I get each value by itself? an array?
do you mean something like this?
SELECT COUNT(otherType),otherType FROM tableName group by otherType;
hope it helps