<?php
set_time_limit(20000);
include_once("../config.php");
include_once("../libDatabase.php");
include_once("../libGeneral.php");
connect();
if(isset($_GET['txtCodeLetter']))
$txtCodeLetter=$_GET['txtCodeLetter'];
//UGLY HACK:
if($txtCodeLetter==" ") $txtCodeLetter="+";
$sql="SELECT distinct ucase(substring(txtCode, 1,1) ) as txtCodeLetter FROM tblscitype";
$resultArray=dbSelect($sql);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>phpMyChord\pda\codeLookup: find sciCode</title>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252">
<meta name="description" content="PDA Web Application
for finding a sciCode and its spelling">
</head>
<body style="direction: ltr;" lang="en-US">
<h2>phpMyChord Code Lookup</h2>
<p>go <a href="..">back to phpMyChord</a> or <a href="index.php">back to phpMyChord/pda</a></p>
<?php
foreach($resultArray as $result)
{
$thisTxtCodeLetter=$result['txtCodeLetter'];
echo "<a href=\"codeLookup.php?txtCodeLetter=$thisTxtCodeLetter\">$thisTxtCodeLetter</a> ";
}
echo "<br>";
if($txtCodeLetter<>"")
{
$sql="SELECT txtCode, txtSpelling FROM tblscitype WHERE txtCode like '$txtCodeLetter%' order BY numNote, txtCode";
$sciTypeResultArray=dbSelect($sql);
//echo "$sql<br>";
if(is_array($sciTypeResultArray))
foreach($sciTypeResultArray as $sciTypeResult)
{
$code=$sciTypeResult['txtCode'];
$spelling=$sciTypeResult['txtSpelling'];
echo " $code <a href=\"spellingLookup.php?spelling=$spelling\">$spelling</a><br>";
}
}
?>
</body>
</html>