bthart Posted July 27, 2009 Share Posted July 27, 2009 Hi, I have got of hold of this snippet of code through another website however in my database I have a number of cells which dont have any data. The code displays these as nothing however I wish still for the lines to be there for easier aligning when looking up data. Here is the code I have, <html> <head><title>(Title Here)</title></head> <body> <?php $db="mydatabase"; $link = mysql_connect("localhost"); if (! $link) die("Couldn't connect to MySQL"); mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); $result = mysql_query( "SELECT * FROM birthdays" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=200 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=1/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; mysql_close($link); ?> </body> </html> Thanks, Brian Quote Link to comment https://forums.phpfreaks.com/topic/167577-allowing-mysql-table-to-display-empty-cells/ Share on other sites More sharing options...
fenway Posted August 3, 2009 Share Posted August 3, 2009 MySQL doesn't "display" anything related to cells... what do you mean? Quote Link to comment https://forums.phpfreaks.com/topic/167577-allowing-mysql-table-to-display-empty-cells/#findComment-889928 Share on other sites More sharing options...
bthart Posted August 12, 2009 Author Share Posted August 12, 2009 Hi, I could not work it out however I have now just put a dot in every cell. This allow for the lines in the table to create empty cells where there is no data and not just leave a section with out lines. Thanks, Brian Quote Link to comment https://forums.phpfreaks.com/topic/167577-allowing-mysql-table-to-display-empty-cells/#findComment-896838 Share on other sites More sharing options...
fenway Posted August 21, 2009 Share Posted August 21, 2009 You can use instead. Quote Link to comment https://forums.phpfreaks.com/topic/167577-allowing-mysql-table-to-display-empty-cells/#findComment-903179 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.