Posted: Mon Dec 01, 2003 2:00 pm
it's because some of your fields are blank. you need to put in an IF clause that checks each of those records to ensure that they are not blank before it posts. something like :
Code: Select all
foreach ($columns as $column)
{
for($i=0; $i<=count($distro); $i++)
{
$sql="SELECT sum(".$column.") FROM distreport03 where RptDist = '".$distro[$i]."'";
$result=mysql_query($sql);
$rows=mysql_fetch_assoc($result);
if(($rows[$column] != '') or ($rows[$column] != 0) or ($rows['RptDist'] != ''))
{
$cols[] = $column;
$distrib[] = $distro[$i];
$total[] = $rows['sum('.$column.')'];
}
}