0

Ok so I have a login page which actually gets an employees ID and password and includes the employee id and surname+firstname in a session. Now in the following page:

<?php
  require_once("nocache.php");

  session_start();

  if (!$_SESSION["who"])
   {
    header("location: logoff.php");
    }
  else 
   {
    $emp = $_SESSION["who"];
    $sn=$_SESSION["surname"];
    $fn=$_SESSION["firstname"];
   }
require_once("dbconn.php");

$sql="SELECT reviewYear,datecompleted,completed FROM reviews WHERE reviews.empid='$emp'";

$rs = mysql_query($sql, $dbConn);

?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title> Review</title>
</head>
<body>
<h1>Review Page</h1>
<p>


<h3>Welcome to the Review Page <?php echo $fn;?> <?php echo $sn;?>  (<?php echo $emp; ?>)</h3>

<?php
while ($row = mysql_fetch_array($rs)) { ?>

<h4>Date Completed:</h4>
<?php echo $row["datecompleted"]?>
<h4>Review Year</h4>
<?php echo $row["reviewYear"]?>
<h4>Completed</h4>
<?php echo $row["completed"]?>

<?php }; ?>
<br/>
<a href="logoff.php">Log Off</a><br/> 

</p>

</body>

</html>

Im trying to get the page to show the details i.ereviewYear,datecompleted,completed from the reviews table for the logged in user.I tried doing an sql statement,but i doesnt work.Could someone please help me out?:(

3
Contributors
11
Replies
12
Views
7 Years
Discussion Span
Last Post by Roses89
0

I just thought of doing that too.Let me see and let u know

0

I did echo the $emp.Even in the above code.On line 37, ive echoed the emp.But i still dont get the values i want!:S

0

check whether the sessions are properly retrieved and the result echoed by $emp r8?

Edited by rajarajan07: n/a

0

Yep i checked it.When i call the variables in line 37 i check that they've been retrieved.

0

Hey i got it working!!It was a simple mistake!!Thanks!:)

0

Great !!

Maybe you can post here what went wrong with the script so others can refer to it, if needed

Edited by qualitybrains: Change

0

Suggestions :
1. put session_start() on top (before require_once("nocache.php")) cause if nocache.php sends any header, the script will not work.
2. Just after ' $emp = $_SESSION["who"]; ' write echo $emp;
3. Let me know if you are able to print the value of $emp.

Yep i got it done.It does echo the $emp cuz i used it in line 37 to Welcome the employee that is logged in.Thanks!:)

0

Great !
Please close this post as Solved :)

Thanks
Vivi
First, solve the problem. Then, write the code.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.