Thundarfoot Posted January 15, 2008 Share Posted January 15, 2008 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 More sharing options...
awpti Posted January 15, 2008 Share Posted January 15, 2008 If a result is empty, echo out You'll have to do some conditionals Link to comment https://forums.phpfreaks.com/topic/86045-solved-draw-empty-cells-in-table/#findComment-439413 Share on other sites More sharing options...
Thundarfoot Posted January 15, 2008 Author Share Posted January 15, 2008 I guess I should have mentioned I am so noob lol. that was way over my head. but thanks! Link to comment https://forums.phpfreaks.com/topic/86045-solved-draw-empty-cells-in-table/#findComment-439414 Share on other sites More sharing options...
sasa Posted January 15, 2008 Share Posted January 15, 2008 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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/86045-solved-draw-empty-cells-in-table/#findComment-439529 Share on other sites More sharing options...
Thundarfoot Posted January 15, 2008 Author Share Posted January 15, 2008 Thank you. Link to comment https://forums.phpfreaks.com/topic/86045-solved-draw-empty-cells-in-table/#findComment-439618 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.