我的数据库里有两张表。
1=属性(包含属性的图像)2=生成器(包含生成器的徽标)
我从properties表中检索到数据,并在表中显示如下。。
<?php
while($list = mysqli_fetch_array($result) ){
echo"<tr>";
echo"<td>".$list['id']."</td>";
echo"<td>".$list['owner']."</td>";
echo"<td>".$list['purpose']."</td>";
echo"<td>".$list['property_type']."</td>";
echo"<td>".$list['city']."</td>";
echo"<td>".$list['location']."</td>";
echo"<td>".$list['description']."</td>";
echo"<td>".$list['price']."</td>";
echo"<td>".$list['land_area']."</td>";
echo"<td>".$list['bedrooms']."</td>";
echo"<td>".$list['bathrooms']."</td>";
echo"<td>".$list['property_expire']."</td>";
echo"<td>"."<img height='50' width='50' src='".$list['image_url']."'/>"."</td>";
echo "<td><a href=\"edit_property.php?id=$list[id]\">Edit</a> | <a href=\"delete_property.php?id=$list[id]\" onClick=\"return confirm('Are you sure you want to delete?')\">Delete</a></td>";
echo"</tr>";
}
?>
我想要的是:
显示属性表的所有内容,我已经做了,但我想得到建设者的标志,以及从建设者表…我怎么能??
最佳答案
您可以在查询中使用类似的内容。
Select P.propertyId, L.logoName from properties as P
Left Join logos as L ON P.logo_id = L.id
关于php - 从mysql中的两个表中检索数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35619298/