Dear all, I have a problem to count the total of receiving items.. but when I run this code I output of the total displayed "1".. not "5"...here my code.. hope someone can help me to count the total of receiving..
<?php
include 'connection/db_connect.php';
?>
<form name="form1" method="post" action="">
<table width="357" height="42" border="1" cellspacing="0">
<tr>
<td width="132">Dept</td>
<td width="108">Doc A</td>
<td width="109">Doc B</td>
</tr>
<?php
$sql = "SELECT l.doc_id, l.doc_name, l.receiver, d.dept_id, d.dept_name
FROM list l, dept d WHERE l.iso_cat='2' AND l.issuer=d.dept_id";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
$rec = $row['receiver'];
$dept_rc=split(",",$rec);
$d1 = '4';
if(in_array($d1,$dept_rc) == TRUE){ //dp2
$dc1="1"; } else $dc1="0";
for($x=0; $x <= count($dc1['$x']); $x++) {
}
?>
<tr>
<td><?php echo $row['dept_name']; ?></td>
<td><?php echo $dc1; ?></td>
<td> </td>
</tr>
<?php } ?>
<tr>
<td>Total</td>
<td><?php echo count($dc1['$x']); ?></td>
<td> </td>
</tr>
</table>
</form>