2 part question (newbie questions): Using the code below-
Background:
1) I have about 40 tables with a single database that I want to display. These are imported from Excel. I plan on using the same code for each webpage. Being concerned about security, how do I go about pulling the username and password from somewhere else outside the web tree in order to avoid mistakenly showing the username and password in case of a future error (granted, these are for public viewing by all people, but would like to protect this information - use of md5?). Right now, the same username and password is assigned for each table. I believe this can be done using an include file? Yes? Pointers?
2) My test page can be seen at the following URL:
http://www.lithuaniangenealogy.org/test/test2.php
I was trying to pull the field heading from the table and have not been successful. I then tried coding into directly as HTML, and now it inserts it in every column and row.
Plus, I want to set each column at a fixed width. However, my solution does not appear to be working either. What am I doing wrong with this?
<?php
$dbh=mysql_connect ("localhost", "<username>", "<password>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("lithuani_LGGSonline");
$query = "SELECT * FROM testtable";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
echo "<TABLE BORDER=1>";
echo "<tr>";
echo "<td width=100>Name of Child{$row['Name of Child']}</td>";
echo "<td width=100>Date of Baptism{$row['Baptismal Date']}</td>";
echo "<td width=100>Name of Parents{$row['Name of Parents']}</td>";
echo "<td width=100>Name of Godparents{$row['Name of Godparents']}</td>";
echo "</tr>";
echo "</TABLE>";
}
//A check to make sure I was actually connecting correctly
//$rows = mysql_num_rows($result);
//if ((!$result) or ($rows<1)) {
// echo "No result returned";
//}
//else {
// echo "Result returned.";
//}
?>