一次回音员工姓名

时间:2019-05-22 06:00:08

标签: php mysql pdo

此代码用于显示员工的项目工作和工作时间。我要回显姓名并添加员工的工作时间。

<?php
$sql = "
SELECT p.id as lid
     , e.FirstName
     , e.LastName
     , e.EmpId
     , e.id
     , e.Gender
     , e.Phonenumber
     , e.EmailId
      , p.Project
     , p.Cur_Date
     , p.Hours
     , p.Description
     , p.PostingDate
     , p.Status
     , p.AdminRemark
     , p.AdminRemarkDate
  from tblprojects p
  join tblemployees e
    on p.empid = e.id 
 where p.empid=:lid -- this is a placeholder 
   and p.PostingDate = '$PostingDate'  -- this is not 
"; 
$query = $dbh -> prepare($sql);
$query->bindParam(':lid',$lid,PDO::PARAM_STR); 
$query->execute(); 
$results=$query->fetchAll(PDO::FETCH_OBJ);
 $cnt=1;
echo $results->FirstName ;
if($query->rowCount() > 0)
{
foreach($results as $result)  
{         
   echo ($result->Project);
   echo htmlentities($result->PostingDate);
  echo htmlentities($result->Hours);
  echo htmlentities($result->Description);
</td>

  
Want to display Employee name and sum of worked hours.

0 个答案:

没有答案