Well, attempting to use the above snippets that were given, I am getting the following error.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/web/lithuani/public_html/test/test6.php on line 116
The code is:
<?php
include("../../includes/test.inc");
$dbh=@mysql_connect ("$dbhost", "$dbuser", "$dbpass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("$dbname");
$query = "SELECT * FROM testtable ORDER BY 'Name of Child' WHERE 'Name of Child' LIKE '$letter%'";
$result = mysql_query($query);
// Output letters as links: (Rem. ascii range from 65 to 90 are letters A to Z!)
for($x=65;$x<=90;$x++)
{
if ($x==ord($subsel)) echo "<b>".chr($x)."</b>";
else
echo "<a href=\"test6.php?letter=".chr($x)."\">".chr($x)."</a> ";
}
$letter = $_GET["letter"];
echo "<TABLE BORDER=1 cellpadding=5>";
echo "<tr bgcolor=\"#9999CC\">";
echo "<td width=18%><strong>Name of Child</strong></td>";
echo "<td width=20%><strong>Name(s) of Parents</strong></td>";
echo "<td width=25%><strong>Name(s) of Godparents</strong></td>\n";
echo "</tr>";
while ($row = mysql_fetch_array($result)) //THIS IS LINE 116
{
echo "<tr>";
echo "<td><strong>{$row['Name of Child']}</strong><br> Baptismal Date:<em>{$row['Baptismal Date']}</em></td>";
echo "<td>{$row['Name of Parents']}</td>";
echo "<td>{$row['Name of Godparents']}</td>";
echo "</tr>";
}
echo "</TABLE>";
$today = date("l dS of F Y h:i a");
print "<CENTER>Today is $today (server time)</CENTER>";
?>
This is the webpage that I am testing when I get this:
http://www.lithuaniangenealogy.org/test/test6.php
As you can see, the alphabet links are generated, but the table from the database is not. Right now, the original page looks like:
http://www.lithuaniangenealogy.org/databases/il/HolyCross.html
This is what I want to happen as default (full table listed alphabetcically), with the alphabet character links before the table is generated.
I have tried changing this in several ways, but this is the closest I get without having multiple errors.
Thanks for all your help so far.