Jump to content

ALLOWING MYSQL TABLE TO DISPLAY EMPTY CELLS


bthart

Recommended Posts

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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.