Hello Php Friends, I have this search code, it wents well but i want to add and echo or maybe a script that woul tell "NO RESULTS FOUND" in case the search does not found data in the database. Please anyone can help.
include 'Connect.php';
//Connect to MySQL Server
mysql_connect($host, $dbusername, $dbpassword);
//Select Database
mysql_select_db($dbname) or die(mysql_error());
// Retrieve data from Query
$first_name = $_GET['first_name'];
// Escape User Input to help prevent SQL Injection
$first_name = mysql_real_escape_string($first_name);
$query = "SELECT * FROM student_information WHERE first_name = '$first_name'";
$qry_result = mysql_query($query) or die(mysql_error());
$display_string = "<table border='1' cellpadding='10' cellspacing='1' align='center'>";
$display_string .= "<tr align='center'>";
$display_string .= "<th>LR Number</th>";
$display_string .= "<th>F i r s t N a m e</th>";
$display_string .= "<th>L a s t N a m e</th>";
$display_string .= "<th>Grade</th>";
$display_string .= "<th>Section</th>";
$display_string .= "<th>View</th>";
$display_string .= "<th>Update</th>";
$display_string .= "<th>Delete</th>";
$display_string .= "</tr>";
// Insert a new row in the table for each person returned
while($row = mysql_fetch_array($qry_result)){
$display_string .= "<tr>";
$display_string .= "<td>$row[LRN]</td>";
$display_string .= "<td>$row[first_name]</td>";
$display_string .= "<td>$row[last_name]</td>";
$display_string .= "<td>$row[grade]</td>";
$display_string .= "<td>$row[section]</td>";
$display_string .= "<td><a href='View_Profile.php?id=$student_id'>View</a> </td>";
$display_string .= "<td><a href='Admin_Edit_Student_Info.php?id=$student_id'>Update</a></td>";
$display_string .= "<td><a href='Delete.php?id=$student_id'>Delete</a></td>";
}
$display_string .= "</table>";
echo $display_string;
?>
Kindly tell me what codes i am missing and where exactly to put it.