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);
?>


Reply With Quote
Bookmarks