www.webdeveloper.com
Results 1 to 3 of 3

Thread: Display Border Around Empty Cells

  1. #1
    Join Date
    Nov 2004
    Location
    England Sunderland
    Posts
    102

    Display Border Around Empty Cells

    Hi ppl

    I have a database where i display all data store in mysql database.

    Some columns do not apply to certain records and are therefore left blank, when the data is displayed on my page it only puts a border around the fields with data stored in them and therefore the fields whcih are empty do not have borders around them.

    Is there a way which i can display a border around these empty cells??

    Thanks

    Baz

    PHP Code:
    <?php
    include "mysql_connect_PCR.php";
    $statusselect = isset($_POST['status']) ? $_POST['status'] : array("Raised","In progress","Completed","On Hold","Rejected");
    ?>
    //HTML Checkbox code and various buttons are here
    <?php
    $query
    ="select PCRID, PCRTitle, RaisedBy, TaskDesc, Status, NextStep, Engineer,  date_format(PCRDate,'%d/%m/%Y') from pcr"
    if(
    count($statusselect) < 5
    {
    foreach(
    $statusselect as $key => $value)
    {
     if(
    $key == 0)
     {
      
    $query .= " WHERE status = '".$value."'";
     }
    else
    {
    $query .= " OR status = '".$value."'";
    }
    }
    }
    $query .= " order by PCRDate DESC, Status ASC".$querylimit;

        
    // Execute query
        
    $result mysql_query ($query) or die (mysql_error());

      
        
    // Report an error and exit page if the query has failed
        
    if (!$result) {
      echo(
    "<P>Error performing query: " .
         
    mysql_error() . "</P>");
      exit();
        }
        
        
    // Get number of rows and columns in PCR database
        
    $num_rows mysql_num_rows($result);
        
    $num_cols mysql_num_fields($result);    
      
        
    // Output title fields first
        
    echo '<table class=report cellspacing="0" cellpadding"1" border="1">';
        echo 
    '<tr bgcolor=#EEFFFF align=left><th>ID</th><th>Title</th><th>Raised By</th><th>Description</th><th>Status</th><th>Action</th><th>Engineer</th><th>Date</th></tr>';

        
    // Loop through each row printing out values
        
    for ( $i=1$i <= $num_rows;  $i++ )
        {
      
    $row mysql_fetch_row($result);

      echo 
    '<tr>';
      
    // Loop through each column
      
    for ( $j=0$j $num_cols$j++ )
      {
          if (
    $j==0){
        echo 
    '<td><a href="edit.php?pcrid='.$row[0].'" class=link title="Click To Edit PCR!">'.$row[0].'</a></td>';
          }
          else{
         echo 
    '<td>'.$row[$j].'</td>';
          }
      }
            echo 
    '<td align=left><a href="/PCR/ConfirmDelete.php?pcrid='.$row[0].'"><img border=0 src="/PCR/Images/Trash.gif" title="Click To Delete PCR!"></a></td></tr>';
        }

      echo 
    '</table><br>';

        
    // Free result set 
        
    mysql_free_result($result); 

      
    // Close connection
        
    mysql_close($link);

    ?>

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    replace all your "<td>"'s with "<td>&amp;nbsp;"'s.

    Note that this is IE only as every other browser uses the standards.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  3. #3
    Join Date
    Nov 2004
    Location
    England Sunderland
    Posts
    102
    Thanks

    I did as you said and it still left them without the border but i played around and replaced all of my

    "<td>"

    with

    "<td>&nbsp;"

    Thanks

    BazJones

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles