Location: PHPKode > projects > phpMyChord > phpMyChord/pda/sciLookup.php
<?php 
 set_time_limit(20000);
 include_once("../config.php");
 include_once("../libDatabase.php");
 include_once("../libGeneral.php");
 connect();

 if(isset($_GET['sci']))
 {
  $sci=sci2sciOptimumForm($_GET['sci']);
  $startNote=sci2startNote($sci);
  $code=sci2sciCode($sci);
  $spelling=sci2spelling($sci);
  $notes=sci2notes($sci);
  $txtNumIntervalForm=spelling2numIntervalForm($spelling);
 }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <title>phpMyChord\pda\sciLookup: find information about a given sci (Scale Chord Interval)</title>
  <meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252">
  <meta name="description" content="PDA Web Application
for finding information about a given sci (Scale Chord Interval)">
 </head>
 <body style="direction: ltr;" lang="en-US">
  <h2>phpMyChord Sci Lookup</h2>
  <p>Use this form to find a sci (scale, chord, or interval) from either
  (1) A comma-delimited series of notes 
  (2) a note and a <a href="codeLookup.php">sci code</a>; or 
  (3) a note and a <a href="spellingLookup.php">spelling</a>.
  The note must be separated by a space from the code or the spelling. 
  e.g. C,E,G , C 3,5 and C M are all the C Major Chord.
  </p>
  <p>The results will show <strong>modes</strong> which are the same as inversions.
  For each note of the sci you have entered, the results will
  show what the sci would be if you started at that note.
  The <strong>preferred</strong> sci is the sci that phpMyChord considers to be the 
  most commonly used sci.
  <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="sciLookup.php" method="get">
   Sci: <input name="sci" type="text" value="<?php echo $sci;?>" />
   <input type="submit" name="submit" value="submit" />
   <input type="reset" name="reset" value="reset" />
   <input type="button" name="clear" value="clear" onclick="frm.sci.value='';" />
  </form>
  <?php
   echo "<h2>$sci</h2>";
   $result=dbSelect("select * from tblscitype where txtSpelling='$spelling'");
   $name=$result[1]['txtName'];
   $altNames=$result[1]['txtAltNames'];
   $numSymForms=$result[1]['numSymForms'];
   if($startNote<>"")
    echo "startNote: $startNote<br>";
   if($code<>"" && $code<>$spelling)
    echo "code: $code<br>";
   if($spelling<>"")
    echo "spelling: <a rel=\"section\" rev=\"section\" href=\"spellingLookup.php?spelling=$spelling\">$spelling</a><br>";
   if($name<>"")
    echo "name: $startNote $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'];
    $modeNote=num2note(spellingElement2num($mode[0])+note2num($startNote),$startNote);
    $modeCode=convertToCodeIfPossible($modeSpelling);

    $modeSci="$modeNote $modeCode";
    echo "$modeNote mode: <a rel=\"section\" rev=\"section\" href=\"sciLookup.php?sci=$modeSci\">$modeSci</a>";
    if($booPrefer) 
     echo " (preferred)";
    echo "<br>";
   }
   $spellingArray=explode(",",$spelling);
   foreach($spellingArray as $spellingArrayElement)
   {
   	$subSpelling=spellingDifference($spelling,$spellingArrayElement);
    if($subSpelling<>"")
    {
     //$subStartNote=$spellingArrayElement
     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