-1
我有三個表:如何使用php-mysql在不同的表中顯示每一行?
員工(僱員,FNAME,LNAME ...)
ProjectHeader(專案編號,LeadID,狀態....)
ProjectDetails(ProjectDetailsID,專案編號....)
這裏是我當前的代碼:
$get_projects = "SELECT DISTINCT projectheader.ProjectID, projectheader.ProjectName ,projectheader.Lead, projectheader.StartDate, projectheader.EndDate, projectheader.Status, projectheader.Remarks, CONCAT (employee.Firstname, ' ' ,employee.Lastname) AS EmployeeName
FROM employee, projectheader, projectdetails
WHERE projectheader.ProjectID = projectdetails.ProjectID
AND projectheader.Lead = employee.EmployeeID";
$result = mysql_query($get_projects);
$project_id = "";
$project_name = "";
$project_lead = "";
$project_start = "";
$project_end = "";
$project_status = "";
$project_remarks = "";
$table = "";
$table .= "<table border='1'> <th>ProjectID</th>"
."<th>Project name</th>"
."<th>Lead</th>"
."<th>Start</th>"
."<th>End</th>"
."<th>Status</th>"
."<th>Remark</th>";
while($row = mysql_fetch_array($result))
{
$project_id = $row['ProjectID'];
$project_name = $row['ProjectName'];
$project_lead = $row['EmployeeName'];
$project_start = $row['StartDate'];
$project_end = $row['EndDate'];
$project_status = $row['Status'];
$project_remarks = $row['Remarks'];
$table .= "<tr>";
$table .= "<td>" .$project_id ."</td>";
$table .= "<td>" .$project_name ."</td>";
$table .= "<td>" .$project_lead ."</td>";
$table .= "<td>" .$project_start ."</td>";
$table .= "<td>" .$project_end ."</td>";
$table .= "<td>" .$project_status ."</td>";
$table .= "<td>" .$project_remarks ."</td>";
$table .= "</tr>";
}
$table .= "</table>";
echo $table;
?>
我現在有現在的問題是這樣的
我想要的是將每行顯示在一個表中,而不是每行都有它的表格。