Create spacing between table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tiingshii
    New Member
    • Aug 2009
    • 1

    Create spacing between table

    i have this working ----- http://pddesignstudio. com/ckc/php2

    now i want to create spacing between each school how do i do it?
    can anyone help mi its my first time dealing with php

    PHP CODE
    Code:
       1. <span class="style2">
       2. <style type="text/css">
       3. <!--
       4. body, th, td, p, small {
       5.     font-family:'Times New Roman',Times,serif;
       6.     font-size:100%;
       7.     color:#757675;
       8. }
       9. small {font-size:90%;}
      10.  
      11. td, th {
      12.     background-color:#FFFFFF;
      13.     border:1px solid #CCCCCC;
      14.     padding:7px 20px 7px 20px;
      15. }
      16. th {background-color:#a5a5a5; color:#FFFFFF;}
      17.  
      18. h1 {font-size:120%; color:#558;}
      19. h1 .sortby {color:#855;}
      20. -->
      21. </style>
      22. </span>
      23.  
      24. <body>
      25.  
      26. <?php
      27. echo '<h1><span class="sortby">'.$header.'</span></h1>
      28. <table summary="List of demo fields">
      29. <tr>
      30. <th>Schools</th>
      31. <th>Dates</th>
      32. <th>Times</th>
      33. </tr>';
      34.  
      35. $fp = fopen('flat-file-data2.txt','r');
      36. if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
      37.  
      38. while (!feof($fp)) {
      39.     $line = fgets($fp,1024); //use 2048 if very long lines
      40.     $row++;
      41.     list ($schools, $dates, $times) = split ('\|', $line);
      42.     if ($sortby == 'schools') $sortkey = strtolower($schools);
      43.     if ($sortby == 'dates') $sortkey = strtolower($dates);
      44.     if ($sortby == 'times') $sortkey = strtolower($times);
      45.     $col[$row] = array($sortkey, $schools, $dates, $times);
      46. }
      47.  
      48. fclose($fp);
      49.  
      50. $arrays = count($col) - 1;
      51.  
      52. $loop = 0;
      53. while ($loop < $arrays) {
      54.     $loop++;
      55.     echo '
      56. <tr>
      57. <td>'.$col[$loop][1].'</td>
      58. <td>'.$col[$loop][2].'</td>
      59. <td>'.$col[$loop][3].'</td>
      60. </tr>';
      61. }
      62.  
      63. echo '
      64. </table>
      65.  
      66. '?>
    .txt
    Anderson Primary School|Monday 15 Dec 2009|2pm to 5pm
    |Monday 15 Dec 2009|2pm to 5pm
    |Monday 15 Dec 2009|2pm to 5pm
    Ahmad Ibrahim Primary School|Monday 15 Dec 2009|2pm to 5pm
    Chongfu Primary School|Monday 15 Dec 2009|2pm to 5pm
    MacPherson Primary School|Monday 15 Dec 2009|2pm to 5pm
    North View Primary School|Monday 15 Dec 2009|2pm to 5pm
    Xishan Primary School|Monday 15 Dec 2009|2pm to 5pm
Working...