HELP - ARRAY Problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

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 »

It's blanking out the page again ...
nwoutback
Forum Newbie
Posts: 17
Joined: Mon Nov 24, 2003 1:50 pm

Post by nwoutback »

some of the $columns' values are blank, but never the distributor or the column names.
Post Reply