wasantha
03-24-2007, 11:09 PM
:confused:
Dear all,
I've got new problem when running of following php codes.
<?php session_start();
if(!isset($_SESSION["Emp_No"])||!isset($_SESSION["Dep_Name"])||!isset($_SESSION["User_Level"])||!isset($_SESSION["Email"])||!isset($_SESSION["First_Name"])) {
header("Location:./error.php");
}
if($_SESSION["User_Level"]=='1'||$_SESSION["User_Level"]=='2'||$_SESSION["User_Level"]=='3') {
header("Location:./error.php");
}
$empid =$_SESSION['Emp_No'];
$dbhost='localhost';
$dbuser='root';
$dbpass='';
$dbname='metrosite';
$a = $_SESSION["SupID"];
$b = $_SESSION["TepID"];
//echo $a ;
//echo $b;
function displayListBox($x){
$list = array( 5 => "Excellent", 4 => "Very good", 3 => "good",2 => "Average", 1 => "Need Improvement");
foreach($list as $index => $set ){
if($index ==$x)
print "<option value=\"$index\" selected>".$set."</option>";
else
print "<option value=\"$index\">".$set."</option>";
}
}
if(!isset($_POST["Submit"])){
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());
$query ="select * from appraiser where Sup_Epf_No ='$a' and Mem_Epf_No ='$b' ;";
$result = mysql_query($query,$conn);
mysql_close($conn);
$row = mysql_fetch_array($result);
}else{
//$SEPFNO=$_POST["sepfno"];
//$TEPFNO=$_POST["tepfno"];
$JOBKNOWLEDGE=$_POST["jobknow"];
$PLANNINGORGANISATION =$_POST["planorg"];
$LEADERSHIP=$_POST["lead"];
$COMMUNICATION=$_POST["commun"];
$PROBLEMSOLVINGDECISIONMAKING=$_POST["probsoldec"];
$CUSTOMERCARE=$_POST["cuscare"];
$CREATIVITYINNOVATION=$_POST["creainn"];
$SELFMOTIVATION=$_POST["selfmo"];
$CONDUCTDISCIPLINE=$_POST["condis"];
$TEAMWORK=$_POST["teamw"];
$CONTINUOUSDEVELOPMENT=$_POST["condev"];
$PERFORMANCEUNDERPRESSURE=$_POST["perundpre"];
$PERCENTAGEOFPERFORMANCE=$_POST["total"];
$TRAININGREQUIREMENT =$_POST["trainreq"];
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());
//$sql = "INSERT INTO `Appraiser` ( `Sup_Epf_No` , `Mem_Epf_No` , `Job_Know` , `Plan_and_Org` , `Lead` , `Comm` , `Prob_solv_Dm` , `Cus_Care` , `Creat_and_Inno` , `Self_Motiv` , `Conduct_And_Dic` , `Team_Work` , `Cts_Dev` , `Perf_Under_Pres` , `Pof` )
//VALUES ('$SEPFNO','$TEPFNO','$JOBKNOWLEDGE','$PLANNINGORGANISATION','$LEADERSHIP','$COMMUNICATION','$PROBLE MSOLVINGDECISIONMAKING','$CUSTOMERCARE','$CREATIVITYINNOVATION','$SELFMOTIVATION','$CONDUCTDISCIPLIN E','$TEAMWORK','$CONTINUOUSDEVELOPMENT','$PERFORMANCEUNDERPRESSURE','$PERCENTAGEOFPERFORMANCE')";
$sql = " UPDATE `appraiser` SET `Job_Know` = '$JOBKNOWLEDGE',
`Plan_and_Org` = '$PLANNINGORGANISATION',
`Lead` = '$LEADERSHIP',
`Comm` = '$COMMUNICATION',
`Prob_solv_Dm` = '$PROBLEMSOLVINGDECISIONMAKING',
`Cus_Care` = '$CUSTOMERCARE',
`Creat_and_Inno` = '$CREATIVITYINNOVATION',
`Self_Motiv` = '$SELFMOTIVATION',
`Conduct_And_Dic` = '$CONDUCTDISCIPLINE',
`Team_Work` = '$TEAMWORK',
`Cts_Dev` = '$CONTINUOUSDEVELOPMENT',
`Perf_Under_Pres` = '$PERFORMANCEUNDERPRESSURE',
`Pof` = '$PERCENTAGEOFPERFORMANCE',
`Training_Req` = '$TRAININGREQUIREMENT'
WHERE `Sup_Epf_No` = '$a' AND `Mem_Epf_No` = '$b' LIMIT 1 ; ";
if(mysql_query($sql,$conn))
echo "update succesful";
else
echo(mysql_errno($conn));
}
if(!isset($_REQUEST['Sup_Epf_No'=='$d']) && !isset($_REQUEST['Mem_Epf_No'=='$c'])){
$query1 = "SELECT all emp.Emp_No emp,emp.First_Name first,emp.Last_Name last FROM appraiser,emp WHERE emp.Emp_No=appraiser.Sup_Epf_No AND appraiser.Mem_Epf_No='$empid'";
//$query1 ="select * from appraiser where Mem_Epf_No ='$empid' ;";
//$query1 ="select * from appraiser where Mem_Epf_No ='$c' ;";
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());
$result1 = mysql_query($query1,$conn);
if (!$result1) {
$message = 'Invalid query: ' . mysql_error() ."\n";
$message .= 'Whole query: ' . $query1;
die($message);
}
elseif(mysql_num_rows($result1)==0) {
echo "<font class=\"style1\" color=\"#FF0000\" size=\"+3\">You have not entered anyone's details into the system?<br><br>See later,once once submitted the Appraiser evalution of your Team members.<br><br><br></font><font class=\"style1\" color=\"#0000CC\" size=\"+3\">Regards,<br>HR Dept.</font>";
exit;
}
while($row1=mysql_fetch_array($result1)) {
echo "<a href='modifyAppraiser.php?empid=$row1[emp]'>".$row1["first"]." ".$row1["last"]."</a><br>";
}
$row1 = mysql_fetch_array($result1);
mysql_close($conn);
}
?>
The problem is that it only showed the "message";(Evenif the data are there)
You have not entered anyone's details into the system
See later,once once submitted the Appraiser evalution of your Team members.
Regards,
HR Dept.
What I want is to show that "first name and last name" of all the persons under the superior.When it click it should go to the "modifyAppraiser.php".
How can do it.Where I went wrong.
Can someone help me.
Tks
wasantha
Dear all,
I've got new problem when running of following php codes.
<?php session_start();
if(!isset($_SESSION["Emp_No"])||!isset($_SESSION["Dep_Name"])||!isset($_SESSION["User_Level"])||!isset($_SESSION["Email"])||!isset($_SESSION["First_Name"])) {
header("Location:./error.php");
}
if($_SESSION["User_Level"]=='1'||$_SESSION["User_Level"]=='2'||$_SESSION["User_Level"]=='3') {
header("Location:./error.php");
}
$empid =$_SESSION['Emp_No'];
$dbhost='localhost';
$dbuser='root';
$dbpass='';
$dbname='metrosite';
$a = $_SESSION["SupID"];
$b = $_SESSION["TepID"];
//echo $a ;
//echo $b;
function displayListBox($x){
$list = array( 5 => "Excellent", 4 => "Very good", 3 => "good",2 => "Average", 1 => "Need Improvement");
foreach($list as $index => $set ){
if($index ==$x)
print "<option value=\"$index\" selected>".$set."</option>";
else
print "<option value=\"$index\">".$set."</option>";
}
}
if(!isset($_POST["Submit"])){
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());
$query ="select * from appraiser where Sup_Epf_No ='$a' and Mem_Epf_No ='$b' ;";
$result = mysql_query($query,$conn);
mysql_close($conn);
$row = mysql_fetch_array($result);
}else{
//$SEPFNO=$_POST["sepfno"];
//$TEPFNO=$_POST["tepfno"];
$JOBKNOWLEDGE=$_POST["jobknow"];
$PLANNINGORGANISATION =$_POST["planorg"];
$LEADERSHIP=$_POST["lead"];
$COMMUNICATION=$_POST["commun"];
$PROBLEMSOLVINGDECISIONMAKING=$_POST["probsoldec"];
$CUSTOMERCARE=$_POST["cuscare"];
$CREATIVITYINNOVATION=$_POST["creainn"];
$SELFMOTIVATION=$_POST["selfmo"];
$CONDUCTDISCIPLINE=$_POST["condis"];
$TEAMWORK=$_POST["teamw"];
$CONTINUOUSDEVELOPMENT=$_POST["condev"];
$PERFORMANCEUNDERPRESSURE=$_POST["perundpre"];
$PERCENTAGEOFPERFORMANCE=$_POST["total"];
$TRAININGREQUIREMENT =$_POST["trainreq"];
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());
//$sql = "INSERT INTO `Appraiser` ( `Sup_Epf_No` , `Mem_Epf_No` , `Job_Know` , `Plan_and_Org` , `Lead` , `Comm` , `Prob_solv_Dm` , `Cus_Care` , `Creat_and_Inno` , `Self_Motiv` , `Conduct_And_Dic` , `Team_Work` , `Cts_Dev` , `Perf_Under_Pres` , `Pof` )
//VALUES ('$SEPFNO','$TEPFNO','$JOBKNOWLEDGE','$PLANNINGORGANISATION','$LEADERSHIP','$COMMUNICATION','$PROBLE MSOLVINGDECISIONMAKING','$CUSTOMERCARE','$CREATIVITYINNOVATION','$SELFMOTIVATION','$CONDUCTDISCIPLIN E','$TEAMWORK','$CONTINUOUSDEVELOPMENT','$PERFORMANCEUNDERPRESSURE','$PERCENTAGEOFPERFORMANCE')";
$sql = " UPDATE `appraiser` SET `Job_Know` = '$JOBKNOWLEDGE',
`Plan_and_Org` = '$PLANNINGORGANISATION',
`Lead` = '$LEADERSHIP',
`Comm` = '$COMMUNICATION',
`Prob_solv_Dm` = '$PROBLEMSOLVINGDECISIONMAKING',
`Cus_Care` = '$CUSTOMERCARE',
`Creat_and_Inno` = '$CREATIVITYINNOVATION',
`Self_Motiv` = '$SELFMOTIVATION',
`Conduct_And_Dic` = '$CONDUCTDISCIPLINE',
`Team_Work` = '$TEAMWORK',
`Cts_Dev` = '$CONTINUOUSDEVELOPMENT',
`Perf_Under_Pres` = '$PERFORMANCEUNDERPRESSURE',
`Pof` = '$PERCENTAGEOFPERFORMANCE',
`Training_Req` = '$TRAININGREQUIREMENT'
WHERE `Sup_Epf_No` = '$a' AND `Mem_Epf_No` = '$b' LIMIT 1 ; ";
if(mysql_query($sql,$conn))
echo "update succesful";
else
echo(mysql_errno($conn));
}
if(!isset($_REQUEST['Sup_Epf_No'=='$d']) && !isset($_REQUEST['Mem_Epf_No'=='$c'])){
$query1 = "SELECT all emp.Emp_No emp,emp.First_Name first,emp.Last_Name last FROM appraiser,emp WHERE emp.Emp_No=appraiser.Sup_Epf_No AND appraiser.Mem_Epf_No='$empid'";
//$query1 ="select * from appraiser where Mem_Epf_No ='$empid' ;";
//$query1 ="select * from appraiser where Mem_Epf_No ='$c' ;";
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error());
mysql_select_db($dbname, $conn) or die (mysql_error ());
$result1 = mysql_query($query1,$conn);
if (!$result1) {
$message = 'Invalid query: ' . mysql_error() ."\n";
$message .= 'Whole query: ' . $query1;
die($message);
}
elseif(mysql_num_rows($result1)==0) {
echo "<font class=\"style1\" color=\"#FF0000\" size=\"+3\">You have not entered anyone's details into the system?<br><br>See later,once once submitted the Appraiser evalution of your Team members.<br><br><br></font><font class=\"style1\" color=\"#0000CC\" size=\"+3\">Regards,<br>HR Dept.</font>";
exit;
}
while($row1=mysql_fetch_array($result1)) {
echo "<a href='modifyAppraiser.php?empid=$row1[emp]'>".$row1["first"]." ".$row1["last"]."</a><br>";
}
$row1 = mysql_fetch_array($result1);
mysql_close($conn);
}
?>
The problem is that it only showed the "message";(Evenif the data are there)
You have not entered anyone's details into the system
See later,once once submitted the Appraiser evalution of your Team members.
Regards,
HR Dept.
What I want is to show that "first name and last name" of all the persons under the superior.When it click it should go to the "modifyAppraiser.php".
How can do it.Where I went wrong.
Can someone help me.
Tks
wasantha