我有两个左外连接的表。我希望使用PHP显示来自两个表的信息。
这是我的问题:
$query = "SELECT headcount.*, empinfo.*
FROM headcount LEFT OUTER JOIN empinfo ON headcount.id = empinfo.id
WHERE empinfo.IsActive = '1'
AND headcount.HomeDept ='Rides 1' ORDER BY headcount.EmployeeName ASC";
以下是声明的其余部分:
IsUnderage位于empinfo表中。 EmployeeName,JobTitle位于headcount表中。两个表中的id匹配。
echo "<tr>";
echo '<td>' . $row['EmployeeName'] . '</td>';
echo '<td>' . $row['JobTitle'] . '</td>';
echo '<td>' . $row['IsUnderage'] . '</td>';
echo '<td><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
echo "</tr>";
前两个(EmployeeName,JobTitle)工作正常,但IsUnderage不起作用。我尝试使用$ row [&#39; empinfo.IsUnderage&#39;],但这也不起作用。
一行数据转储(*保密信息):
Array ( [0] => * [EmployeeName] => * [1] => * [DOB] => * [2] => 18 [Age] => 18
[3] => * [StreetAddress] => * [4] => * [City] => * [5] => * [State] => *
[6] => * [ZipCode] => * [7] => * [Email] => * [8] => * [HomePhone] => *
[9] => * [Wireless] => * [10] => * [JobTitle] => * [11] => 7006 [id] => 7006 [12] => * [HomeDept] => *
[13] => * [Manager] => * [14] => 7006 [15] => 1 [isActive] => 1 [16] => 0 [isUnderage] => 0 [17] => [submittedAOHform] =>
[18] => [eightDailyHours] => [19] => [nineDailyHours] => [20] => [schoolWeekThirty] => [21] => [schoolWeekForty] => [22] => [nonSchoolThirty] =>
[23] => [nonSchoolForty] => [24] => [pastTenPM] => )
这里有什么想法吗?
答案 0 :(得分:1)
将IsUnderage
替换为isUnderage
echo '<td>' . $row['isUnderage'] . '</td>';