0

联系

<?php

$host = "localhost";
$user = "root";
$password = "";

mysql_connect($host, $user, $password);
mysql_select_db("admin");
SESSION_START();
if($_SESSION["loggedin"]!="true")
    header("location:login.php");

$id = $_REQUEST["Emp_ID"];
$test = mysql_query("select * from Employee inner join department where Emp_ID =$id");
$row = mysql_fetch_assoc($test);
?>

详细信息表

<table align="left" border="0" width="700px" cellpadding="0" cellspacing="5px">
        <tr>
            <th>Name :</th>
            <td><?php echo $row["Emp_Fname"];?></td>
        </tr>
        <tr>
            <th>Handphone :</th>
            <td><?php echo $row["ContactNo_HP"];?></td>
        </tr>
        <tr>
            <th>Telephone :</th>
            <td><?php echo $row["ContactNo_Home"];?></td>
        </tr>
        <tr>
            <th>Address :</th>
            <td><?php echo $row["Emp_Address"];?></td>
        </tr>
        <tr>
            <th>Email :</th>
            <td><?php echo $row["Emp_Email"];?></td>
        </tr>
        <tr>
            <th>Department :</th>
            <td><?php echo $row["Dept_Desp"];?></td>  
        </tr>
    </table>
  1. 我的 Dept_Desp 是表“部门”内的数据

  2. 只显示部门名称的第一个数据,不能显示真实的

4

1 回答 1

0
select * from Employee left join department on employee.department_id = department.department_id where Emp_ID =$id

像这样的东西......也阅读了mysqli或pdo......你的数据库方法非常不安全。

于 2013-08-26T19:26:48.580 回答