0

hi everyone,
i write data from database to the csv file,but i face problem how to print the csv file with multiple colors background for example first line is green then second line must be blue,
please help me how can i do this in php

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by linuxaomi
0

Did you say print ? To print on paper ?

I am doing the following: display HTML code on the screen and use CSS media=print.
(Sorry for the poor layout below)

echo'<style type="text/css" media="print">';
echo "TABLE {
 border:1pt solid #000;
 border-collapse:collapse;
 font-family:arial,sans-serif;
 font-size:90%;
 background-color: red;
}
TD,TH{
 border:1pt solid #000;
 border-collapse:collapse;
 white-space: nowrap;
 font-size:90%;
 text-align:center;
}";
echo'</style>';

echo "<div STYLE=' height: 257pt; font-size: 12pt; overflow: auto;'>";
echo "<TABLE BORDER=1 WIDTH='100%'>";
.
.
.
  for ($i =  0; $i < $nrg88_num_rows; $i++)
     {
      $nrg88_row                       = mysql_fetch_row($nrg88_sql_result);

      $nrg88_color = '#ffffff';
      if ($i % 2 == 1)
        {
         $nrg88_color = '#eeeeee';
        }
      echo "<TR>";
      $nrg88_col0[$i]                  = $nrg88_row[0];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col0[$i]</TD>";
      $nrg88_col1[$i]                  = $nrg88_row[1];
      echo "<TD style='width:15%; background-color:$nrg88_color;'>$nrg88_col1[$i]</TD>"; 
      $nrg88_col2[$i]                  = $nrg88_row[2];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col2[$i]</TD>";
      $nrg88_col3[$i]                  = $nrg88_row[3];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col3[$i]</TD>";
      $nrg88_col4[$i]                  = $nrg88_row[4];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col4[$i]</TD>";
      $nrg88_col5[$i]                  = $nrg88_row[5];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col5[$i]</TD>";
      $nrg88_col6[$i]                  = $nrg88_row[6];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col6[$i]</TD>";
      $nrg88_col7[$i]                  = $nrg88_row[7];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col7[$i]</TD>";
      $nrg88_col8[$i]                  = $nrg88_row[8];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col8[$i]</TD>";
      $nrg88_col9[$i]                  = $nrg88_row[9];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col9[$i]</TD>";
      $nrg88_col10[$i]                 = $nrg88_row[10];
      echo "<TD style='width:7.5%; background-color:$nrg88_color;'>$nrg88_col10[$i]</TD>";
      echo "</TR>";
     
     }
     
      #echo "</TR>";
      echo "</TABLE>";
      echo "</div>";

Would be glad if this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.