Hi, I have been trying to create a searchable database and have the following code for my form and the action code.
When the form is changed/submitted ll I get is an error "Query was empty"
Can anyone offer any help??
SEARCH By Last Name (Letter)<form NAME="navsel" action="sel_byLetter.php" method="get">
<select NAME="LETTER" ONCHANGE="document.forms[0].submit();">
<option>please select a Letter...
</option><option value="A">A
</option><option value="B">B
</option><option value="C">C
</option><option value="D">D
</option><option value="E">E
</option><option value="F">F
</option><option value="G">G
</option><option value="H">H
</option><option value="I">I
</option><option value="J">J
</option><option value="K">K
</option><option value="L">L
</option><option value="M">M
</option><option value="N">N
</option><option value="O">O
</option><option value="P">P
</option><option value="Q">Q
</option><option value="R">R
</option><option value="S">S
</option><option value="T">T
</option><option value="U">U
</option><option value="V">V
</option><option value="W">W
</option><option value="X">X
</option><option value="Y">Y
</option><option value="Z">Z
</option></select></form>
the action php code
$LETTER = $_GET;
if($LETTER[A]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='A' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[B]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='B' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[C]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='C' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[D]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='D' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[E]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='E' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[F]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='F' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[G]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='G' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[H]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='H' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[I]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='I' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[J]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='J' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[K]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='K' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[L]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='L' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[M]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='M' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[N]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='N' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[O]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='O' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[P]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='P' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[Q]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='Q' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[R]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='R' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[S]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='S' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[T]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='T' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[U]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='U' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[V]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='V' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[W]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='W' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[X]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='X' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[Y]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='Y' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
elseif($LETTER[Z]){$sql = "SELECT `EndowmentNumber`,`LotSize`,`Letter`,`Section`,`LotNumber`,`LotOwner`,`LastName`,`FirstName`,`MiddleInitial`,`MaidenName`,`Suffix`,`Born`,`Died`,`VeteranInfo`,`MiscInfo` FROM `BurialsTable` WHERE Letter='Z' ORDER BY `Letter`, `LastName`, `FirstName`, `FirstName`, `Section`, `LotNumber` ";}
$result = @mysql_query($sql,$connection) or die(mysql_error());
All code files are php.
Any help is appreciated.