daniel0816 Posted September 5, 2013 Share Posted September 5, 2013 How do I set empty table cells to hidden so that they don't show up on screen therefore all data in the table will be aligned correctly. Here is what I have tried so far: <tbody style="empty-cells:hidden"><?php} while($row=mysql_fetch_assoc($result)){ echo "<tr> <td>{$row['CUST_ID']}</td> <td>{$row['CUST_Forename']}</td> <td>{$row['CUST_Surname']}</td> <td>{$row['CUST_Email']}</td> <td>{$row['CUST_Mobile']}</td> <td>{$row['CUST_HomeNum']}</td> <td>{$row['CUST_AddressL1']}</td> <td>{$row['CUST_AddressL2']}</td> <td>{$row['CUST_AddressL3']}</td> <td>{$row['CUST_Postcode']}</td> <td>{$row['J_RefNum']}</td> <td>{$row['MANU_Name']}</td> <td>{$row['J_Model']}</td> <td>{$row['OS_Name']}</td> <td>{$row['J_ReceivedBy']}</td> <td>{$row['J_DateRec']}</td> <td>{$row['J_FaultDesc']}</td> <td>{$row['J_PassWinAdmin']}</td> <td>{$row['J_DataRecYN']}</td> <td>{$row['J_PowerSuppYN']}</td> <td>{$row['JS_Status']}</td> </tr>\n"; } Any suggestions would be greatly appreciated thanks Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/ Share on other sites More sharing options...
cyberRobot Posted September 5, 2013 Share Posted September 5, 2013 It's actually "empty-cells:hide;" https://developer.mozilla.org/en-US/docs/Web/CSS/empty-cells Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1448277 Share on other sites More sharing options...
daniel0816 Posted September 5, 2013 Author Share Posted September 5, 2013 yea that doesn't work either. What I am trying to do is remove the empty cells not hide them. Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1448288 Share on other sites More sharing options...
cyberRobot Posted September 5, 2013 Share Posted September 5, 2013 That would be more of a PHP question then, would you like me to move the topic? Are you trying to remove the entire row if all the cells are empty...or are you just wanting to remove individual cells that is empty? Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1448305 Share on other sites More sharing options...
daniel0816 Posted September 5, 2013 Author Share Posted September 5, 2013 I want to remove individual empty cells. Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1448309 Share on other sites More sharing options...
cyberRobot Posted September 5, 2013 Share Posted September 5, 2013 (edited) Moving to PHP forum. To hide empty cells, you could do something like <?php echo '<tr>'; if(!empty($row['CUST_ID'])) { echo "<td>{$row['CUST_ID']}</td>"; } //... echo '</tr>'; ?> Edited September 5, 2013 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1448312 Share on other sites More sharing options...
priyankagound Posted September 18, 2013 Share Posted September 18, 2013 Try out this one Hide border and background on empty cells in a table: table{border-collapse:separate;empty-cells:hide;} Formal syntax: show | hideempty-cells: showempty-cells: hideempty-cells: inherit Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1450017 Share on other sites More sharing options...
cyberRobot Posted September 18, 2013 Share Posted September 18, 2013 @priyankagound - This is essentially the same thing I suggested in Reply 2. As indicated in Reply 3, the OP isn't interested in hiding the cells. Also, please surround code with tags. Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1450046 Share on other sites More sharing options...
Solution mac_gyver Posted September 18, 2013 Solution Share Posted September 18, 2013 the OP in this thread solved this (and stopped making new threads for the same problem), when he finally got how to properly join his tables using the relationship between that tables, so that the query would retrieve the just the data he wants. marking this thread as solved... Quote Link to comment https://forums.phpfreaks.com/topic/281878-empty-html-table-cells-hidden/#findComment-1450048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.