Hello, I am designing a webpage that reads a database in mysql and I am trying to sort and display the results. This example, I open my database, and pull it into an array. I want to search that array for HmDept="001", then sort the results by alpha (LstName). Can any body help me? Here is the code that I have so far: <?php $conn = mysql_connect("localhost", "root", "cpsint"); mysql_select_db("employees",$conn); $sql = "SELECT * FROM eelist"; $result = mysql_query($sql, $conn) or die(mysql_error()); $display_block = ""; if (mysql_num_rows($result) < 1) { //no record found $display_block .= "<p>No Record Found</p>"; } else { $display_block .= " <table cellpadding=3 cellspacing=2 border=1 width=98%> <tr> <th>First Name</th> <th>Last Name</th> <th>Title</th> <th>Picture</th> </tr>"; while ($newArray = mysql_fetch_array($result)) { $empnumber = $newArray['EmpNo']; $firstname = $newArray['FstName']; $lastname = $newArray['LstName']; $title = $newArray['Title']; $department = $newArray['HmDept']; $picfile = $newArray['PictureFile']; ///////THIS IS WHERE I NEED THE HELP :)/////// //////I WANT TO DISPLAY ONLY DEPARTMENT "001" /////// //////THEN SORT IT ALPHABETICALLY BY LastName////// if ($department == "001") { $display_block .= "<tr> <td align=center>$lastname <br> </td> <td align=center>$firstname <br> </td> <td align=center>$title <br> </td> <td align=center><img src=/EmployeeDirectory/database/$picfile> <br> </td> </tr>"; } } } ?> <html> <head> <title>Administration</title> </head> <body> <p align="center"><a name="top" id="top"></a></p> <p align="center"><a name="top" id="top"></a></p> <p align="center"><font face="Arial" size="3">Administration</font></p> <?php echo $display_block; ?> </body> </html> THANK YOU IN ADVANCE FOR THE HELP!!!! Tony