Hello All,
I'm new to PHP, need some advice for my problem below.
Here is my problem after enter my fullname and search, it show all the fields from a table, but if I enter a invalid fullname(fullname that doesn't exist in fields) , the page goes blank no error has been specified.
example: fullname = James Lee(work fine)
fullname = Jamesss Leeee(page goes blank)
Thank In Advance.
<?php
session_start();
$action=$_POST["submit"];
if ($action=="Back")
{
header("Location:empmenu.php");
}
else
{
$search = $_POST["search"];
//in this section user must search colleague info by using fullname.
if (@mysql_connect("localhost","root",""))
{
if (@mysql_select_db("ems"))
{
$sql = "SELECT * FROM employee WHERE fullname = '$search'";
$result = mysql_query($sql) or die('Error, query failed '. mysql_error());
while($row=mysql_fetch_array($result))
{
$photo = $row[photo];
$empid = $row[empid];
$fullname = $row[fullname];
$address = $row[address];
$dob = $row[dob];
$gender= $row[gender];
$contactno = $row[contactno];
$email = $row[email];
}
}
}
}
?>