Location: PHPKode > projects > phpMyChord > phpMyChord/pda/spellingLookup.php
<?php 
 set_time_limit(20000);
 include_once("../config.php");
 include_once("../libDatabase.php");
 include_once("../libGeneral.php");
 connect();
 if(isset($_GET['spelling']))
 {
  $spelling=orderSpelling($_GET['spelling']);
  $txtNumIntervalForm=spelling2numIntervalForm($spelling);
 }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <title>phpMyChord\pda\spellingLookup: find chord or scale name from spelling</title>
  <meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252">
  <meta name="description" content="PDA Web Application
for finding Scale or Chord name from spelling">
 </head>
 <body style="direction: ltr;" lang="en-US">
  <h2>phpMyChord Spelling Lookup</h2>
  <p>Use this form to find a scale, chord, or interval (sci) type from a spelling.  The spelling entered in this form must be a comma-delimited sequence of 
  of what musicians sometimes call 'scale degrees' omitting the 1. e.g. b3,5 is the minor chord.
  </p>
  <p>The results will show <strong>modes</strong> which are the same as inversions.
  For each scale degree of the spelling you have entered, the results will
  show what the spelling would be if you started at that scale degree.
  The <strong>preferred</strong> mode is the mode that phpMyChord considers to be the 
  most commonly used spelling.
  <p>go <a rel="start" rev="section" href="..">back to phpMyChord</a> or <a rel="chapter" rev="section" href="index.php">back to phpMyChord/pda</a></p>
  <form name="frm" action="spellingLookup.php" method="get">
   Spelling: <input name="spelling" type="text" value="<?php echo $spelling;?>" />
   <input type="submit" name="submit" value="submit" />
   <input type="reset" name="reset" value="reset" />
   <input type="button" name="clear" value="clear" onclick="frm.spelling.value='';" />
  </form>
  <?php
   echo "<h2>$spelling</h2>";
   $result=dbSelect("select * from tblscitype where txtSpelling='$spelling'");
   $code=$result[1]['txtCode'];
   $name=$result[1]['txtName'];
   $altNames=$result[1]['txtAltNames'];
   $numSymForms=$result[1]['numSymForms'];
   if($code<>"")
    echo "code: $code<br>";
   if($name<>"")
    echo "name: $name<br>";
   if($altNames<>"")
    echo "Alternate Name(s): $altNames<br>";
   if($txtNumIntervalForm<>"")
    echo "Numeric Interval Form: <a rel=\"section\" rev=\"section\" href=\"txtNumIntervalFormLookup.php?txtNumIntervalForm=$txtNumIntervalForm\">$txtNumIntervalForm</a><br>";
   if($numSymForms>"0")
    echo "Number of Symmetrical Forms: $numSymForms<br>";
   $modeArray=getModeArray($spelling);
   foreach ($modeArray as $mode)
   {
    $modeSpelling=$mode[1];
    $result=dbSelect("select * from tblscitype where txtSpelling='$modeSpelling'");
    $booPrefer=$result[1]['booPrefer'];
    echo $mode[0]." mode: <a rel=\"section\" rev=\"section\" href=\"spellingLookup.php?spelling=$modeSpelling\">$modeSpelling</a>";
    if($booPrefer) 
     echo " (preferred)";
    echo "<br>";
   }
   $spellingArray=explode(",",$spelling);
   foreach($spellingArray as $spellingArrayElement)
   {
   	$subSpelling=spellingDifference($spelling,$spellingArrayElement);
    if($subSpelling<>"")
     echo "$spellingArrayElement omitted: <a rel=\"section\" rev=\"section\" href=\"spellingLookup.php?spelling=$subSpelling\">$subSpelling</a><br>";
   }
   for($i=1;$i<12;$i++)
   {
   	$sciElement=num2spellingElement($i);
   	$spellingUnion=spellingUnion($spelling,$sciElement);
   	if($spelling <> $spellingUnion)
     echo "$sciElement added: <a rel=\"section\" rev=\"section\" href=\"spellingLookup.php?spelling=$spellingUnion\">$spellingUnion</a><br>";
   }
  ?>
 </body>
</html>
Return current item: phpMyChord