I am a newbie at SQL code and was wondering if someone could help me accomplish the following:
On my site, I have an alumni database for a school. It's at http://www.stcharlesprep.org/alumnidev/alumnisearch.php I'd like to find out how to write the SQL code to order the names properly. First, if keyword parameter or 'Last Name' is given, I'd like it to order by YEAR. If YEAR is the variable, I'd like it to order by LAST NAME. The form field for the Last Name, First Name and Year parameter is called 'search." The keyword box is called "keyword."
Here is the code - can someone please take a look see and assist? Thanks.
On page alumnisearch.php -
<?php require_once('../Connections/connAlumni.php');
mysql_select_db($database_connAlumni, $connAlumni);
$query_rsAlumni = "SELECT Year, LName, FName, Email FROM tb_alumni";
$rsAlumni = mysql_query($query_rsAlumni, $connAlumni) or die(mysql_error());
$row_rsAlumni = mysql_fetch_assoc($rsAlumni);
$totalRows_rsAlumni = mysql_num_rows($rsAlumni);
?>