试图将两个数据显示到一个表中

时间:2019-12-09 21:58:44

标签: php html mysql

我想做的是将来自两个数据库表的数据合并到一个表输出中。下面的代码是我从表事件显示数据的地方。而且我正在尝试从表“ user”中插入另一行“ name”,以便一起显示。

<div class="form">
<table width="100%" border="1" style="border-collapse:collapse;">
<thead>

<tr>
<th><strong>No</strong></th>
<th><strong>Event ID</strong></th>
<th><strong>Club Name</strong></th>
<th><strong>Your Course</strong></th>
<th><strong>Advisor Name</strong></th>
<th><strong>Event Name</strong></th>
<th><strong>Event Venue</strong></th>
<th><strong>Event Date</strong></th>
<th><strong>Participant No</strong></th>
<th><strong>Time Started</strong></th>
<th><strong>Time Ended</strong></th>
</tr>
</thead>
<tbody>
<?php
$count=1;
$sel_query="Select * from event ORDER BY eventID desc;";
$result = mysqli_query($conn,$sel_query);
while($row = mysqli_fetch_assoc($result)) { ?>
<tr><td align="center"><?php echo $count; ?></td>
<td align="center"><?php echo $row["eventID"]; ?></td>
<td align="center"><?php echo $row["club"]; ?></td>
<td align="center"><?php echo $row["course"]; ?></td>
<td align="center"><?php echo $row["advisorName"]; ?></td>
<td align="center"><?php echo $row["eName"]; ?></td>
<td align="center"><?php echo $row["eVenue"]; ?></td>
<td align="center"><?php echo $row["eDate"]; ?></td>
<td align="center"><?php echo $row["studNO"]; ?></td>
<td align="center"><?php echo $row["startTime"]; ?></td>
<td align="center"><?php echo $row["endTime"]; ?></td>
</tr>
<?php $count++; } ?>
</tbody>
</table>
</div>

0 个答案:

没有答案