hi...I'm trying to calculate the total no of item of things in a table, so I select the same item first, then I start adding them and save the total no of items in another table...but the problem is when I start insert the new items, the existing items also adding and insert into the table again...any comments??Furthermore, the output has shown the message (Warning: Cannot modify header information - headers already sent by)...how to solve??
part of the code...

$sql1 = "SELECT DISTINCT id FROM item";
$num1 = mysql_num_rows($result1);
$i = 0;
$total = 0;
if($num1 > 0)
       while($row1 = mysql_fetch_array($result1))
	$sql2 = "SELECT no FROM item WHERE id = '$row1[id]'";
	$result2 = mysql_query($sql2);
	$num2 = mysql_num_rows($result2);

	if($num2 > 0)
	      while($row2 = mysql_fetch_array($result2))
		$total += "$row2[no]";
              $sql3 = "INSERT INTO new_item (id, total) VALUES ('$row1[id]', '$total')";
	$result3 = mysql_query($sql3);
        header("Location: ../things.php?form=s_proposal&&message=success");

      header("Location: ../things.php?form=s_proposal&&msg=error");

Besides, I want to select some items...For example, userA need to insert data for item1, item2 and item3...So I do a drop down list for userA to select the items that userA want to insert...so the drop down list will list out all the items...but now is it possible that the drop down list just list out the items that haven't insert data for it??

code that list out all the items...

<form name="list" method="post" action="things.php?form=things1">
<select name="MatricNo" id="MatricNo" onchange="document.list.submit()">
<option> -- select -- </option>
<?php $list->search(); ?>

I had try a lot of methods to solve all this problem...but not what I expected...anyone got ideas??
thanks in advance...