Hi there i need to make an array with the result from a query (numbers 1-4) I need to calculate how many occurances of each 1-4 number is in the table. Im new to this and havent much experience with arrays but ive managed to create an array and echo the results:
2 Class
3 Class
1 Class
3 Class
3 Class
2 Class
2 Class
2 Class
So i need to somehow Add the occurance of them and echo the results e.g. 4 Class 2, 1 Class 1, 3 Class 3.
If someone could please point me in the right direct that would be great.
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_swb, $swb);
$query = sprintf("SELECT Class FROM ships WHERE PlayerName = %s", GetSQLValueString($colname_Recordset1, "text"));
$result = mysql_query($query, $swb) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['Class']. " Class ";
echo "<br />";
}
mysql_free_result($result);?>;
Thank You