Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
infolock
DevNet Resident
Posts: 1708 Joined: Wed Sep 25, 2002 7:47 pm
Post
by infolock » 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.')'];
}
}
nwoutback
Forum Newbie
Posts: 17 Joined: Mon Nov 24, 2003 1:50 pm
Post
by nwoutback » Mon Dec 01, 2003 2:10 pm
It's blanking out the page again ...
nwoutback
Forum Newbie
Posts: 17 Joined: Mon Nov 24, 2003 1:50 pm
Post
by nwoutback » Mon Dec 01, 2003 2:14 pm
some of the $columns' values are blank, but never the distributor or the column names.