in my ibf_pfields_content table, I want to count the number of times each number occurs, and each number corresponds to a name, 1 is spectator, 3 is trumpet, 4 is horn, and so forth.
here's the code:
$section = Array();
$section[1] = "Spectator";
$section[3] = "Soprano.Trumpet";
$section[4] = "Mellophone.Horn";
... and so on
for($i = 1; $i <=23; $i++) {
$query = "SELECT count(field_2) FROM ibf_pfields_content WHERE field_2 = " . $i;
$result = mysql_query($query);
while ($info = mysql_fetch_assoc($result))
{
$data[$i] = $info['count(field_2)'];
echo($section[$i] . " has " . $data[$i] . " members. <br />");
}
and here is the bit of the skin file which the user reads:
<tr>
<td class='row2'><font color=888888> Spectator</td>
<td class="row2" align=center><font color=888888>{$data[1]}</td>
</tr>
<tr>
<td class='row2'><font color=888888> Soprano.Trumpet</td>
<td class="row2" align=center><font color=888888>{$data[3]}</td>
</tr>
<tr>
<td class='row2'><font color=888888> Mellophone.Horn</td>
<td class="row2" align=center><font color=888888>{$data[4]}</td>
</tr>
...and so on
My problem is, it only does the counting for spectator and doesnt do the rest. I wish I weren't such a helpless newbie. 🙁