I am trying to display the contents of a MySQL table in an HTML table. Although I have managed to do this, if a field is NULL, the HTML cell that corresponds to it will display its borders. Here is my script:
<?
$conn=@mysql_connect("localhost", "", "")
or die("Could not connect");
#select the specified database
$rs = @mysql_select_db("test", $conn)
or die("Could not select database");
#create the query
$sql = "select * from table";
#execute the query
$rs=mysql_query($sql,$conn)
or die("Could not execute query");
#write the users details in a table
$list = "<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\">";
$list.="<tr><th><font face=\"Verdana\" size=\"2\" color=\"#00FF00\">Name</font></th>";
$list.="<th><font face=\"Verdana\" size=\"2\" color=\"#00FF00\">Surname</font></th>";
$list.="<th><font face=\"Verdana\" size=\"2\" color=\"#00FF00\">Telepone Number</font></th></tr>";
while($row= mysql_fetch_array($rs) )
{
$list .= "<tr>";
$list .= "<td><font face=\"Verdana\" size=\"2\" color=\"#00FF00\">".$row["name"]."</font></td>";
$list .= "<td><font face=\"Verdana\" size=\"2\" color=\"#00FF00\">".$row["surname"]."</font></td>";
$list .= "<td><font face=\"Verdana\" size=\"2\" color=\"#00FF00\">".$row["tel"]."</font></td>";
$list .= "</tr>";
}
$list .= "</table>";
echo($list);
?>
Any help would be very much appreciated.
TIA
Jim