我有2个表,我想要回显这2个表中的值。
安排表
计划表
这是我的代码,
<?php
if (!mysqli_connect_errno($con)) {
$sqlQueryStr = "SELECT * FROM scheduletime ST, schedule S WHERE ST.schedule_Id = S.schedule_Id AND ST.staff_Id= $id AND ST.Monday= '1' ";
$result = mysqli_query($con, $sqlQueryStr);
while ($row = mysqli_fetch_array($result)) {
$button[$row['scheduleTime_Id']] = $row;
}
mysqli_close($con);
} else {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
foreach ($button as $id => $info) {
echo $id;
echo $info['startTime']; //startTime is from scheduletime table
echo $info['endTime']; //endTime is from scheduletime table
echo $info['academicInstitution']; //academicInstitution is from schedule table
echo '</br>';
}
我能够回显“scheduletime”中的值,而不是“schedule”。如何回显2个不同表中的值?