Jump to content

[SOLVED] Draw empty cells in table?


Thundarfoot

Recommended Posts

I am outputing mysql table into php drawn table.

Problem is any empty cells do not get drawn, causing ugly look.

Here is the code I am using, any help is most appreciated.

 

while($row = mysql_fetch_array( $result )) {

echo "<tr><td>";

echo $row['Name'];

echo "</td><td>";

echo $row['Class'];

echo "</td><td>";

            echo $row['Grade'];

echo "</td><td>";

      echo $row['Comments'];

echo "</td><td>";

      echo $row['Pic'];

echo "</td></tr>";

Link to comment
https://forums.phpfreaks.com/topic/86045-solved-draw-empty-cells-in-table/
Share on other sites

try

<?php
while($row = mysql_fetch_array( $result )) {
   echo "<tr><td>";
   echo $row['Name'] ? $row['Name'] : ' ';
   echo "</td><td>";
   echo $row['Class'] ? $row['Class'] : ' ';
   echo "</td><td>";
             echo $row['Grade'] ? $row['Grade'] : ' ';
   echo "</td><td>";
      echo $row['Comments'] ? $row['Comments'] : ' ';
   echo "</td><td>";
      echo $row['Pic'] ? $row['Pic'] : ' ';
   echo "</td></tr>";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.