2
我有兩個表,image
和video
。我想在一個表格中顯示來自圖像和視頻的所有數據。我知道如何顯示來自視頻的所有數據,但是如何在同一張表中顯示來自圖像的所有數據。有一張桌子可以顯示來自視頻的所有數據,但是有人可以告訴我如何在顯示來自視頻的數據完成時顯示來自同一個表格中圖像的所有數據。如何在一個表中顯示來自兩個數據表的數據
<table width="879" border="2" cellpadding="3" cellspacing="1">
<tr>
<td colspan="11" align="center" ><strong>All uploaded videos</strong>
</td>
</tr>
<tr>
<td width="51" align="center" bgcolor="#000000" class="yellow"><strong>Id</strong></td>
<td width="95" align="center" bgcolor="#000000" class="yellow"><strong>Video</strong></td>
<td width="83" align="center" bgcolor="#000000" class="yellow"><strong>Name</strong></td>
<td width="130" align="center" bgcolor="#000000" class="yellow"><strong>Date</strong></td>
<td width="177" align="center" bgcolor="#000000" class="yellow"><strong>Description</strong></td>
<td width="101" align="center" bgcolor="#000000" class="yellow"><strong>Price</strong></td>
<td width="174" align="center" bgcolor="#000000" class="yellow"><strong>Added by</strong></td>
</tr>
<?php $path= "videoFile/";
while($rows=mysql_fetch_array($result1)){
?>
<tr>
<td>
<?php if (current_user_can('manage_options')) { echo $rows['vid'];}else { echo "For admins only!"; } ?>
</td>
<td><a href="<?php echo $path.$rows['filename'] ?>">View video</a></td>
<td><?php echo $rows['alttext']; ?></td>
<td><?php echo $rows['imagedate']; ?></td>
<td><?php echo $rows['description']; ?></td>
<td><?php echo "$".$rows['price']; ?></td>
<td><?php echo $rows['user_nicename']; ?></td>
</tr>
<?php
}
?>
</table>
向我們展示您的mysql查詢。 –
$ sql1 =「選擇*從視頻連接wp_users on video.userID = wp_users.id order by imagedate」; $ sql2 =「選擇*從圖像加入wp_users在images.userID = wp_users.id秩序由imagedate」; –