can somebody help me with this code on how to show other fields from the database..
here’s my code:
[CODE]
<table>
<tr>
<td>
<?php
$i=0;
$GetDepts = mysql_query(“SELECT * FROM tblDepartment”) or die (‘MySQL SELECT Error: ‘.mysql_error());
while($DeparmentArray=mysql_fetch_array($GetDepts))
{
$Depts = $DeparmentArray[‘Department’];
$Counts = mysql_query(“SELECT * FROM view_name where Department=’$Depts'”)
or die (‘MySQL SELECT Error: ‘.mysql_error());
$CountedRows[$i] = mysql_num_rows($Counts);
$i++;
}
?>
</td>
<td>
<?
rsort($CountedRows);
foreach ($CountedRows as $rows=> $val) {
echo $val . “<br >”;
}
?>
</td>
</table>
and here’s the database sample:
[CODE]
tblDepartment
DeptId Department
1 CSD
2 HRD
3 DCD
view_name
ReqNum DATE Department PCName
1 JUNE CSD csd-1
2 JUNE CSD csd-2
3 JUNE HRD hrd-1
4 JUNE HRD hrd-2
5 JUNE HRD hrd-3
6 JUNE HRD hrd-4
7 JUNE DCD dcd-1
8 JUNE DCD dcd-2
9 JUNE DCD dcd-3
now my problem is when i use the code i made,it shows the counted rows of each department which in this case the result will be like this
[CODE]
4 //this is the HRD which is not showed but i want to show this label
3 //this is the DCD which is not showed but i want to show this label
2 //this is the CSD which is not showed but i want to show this label
what i want to do is also show the current department title…
something like this:
department | result
HRD | 4
DCD | 3
CSD | 2
hope someone can help me about this.tnx