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

  • 2 weeks later...
  • 2 weeks later...

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.