Php 根据mysqli中的ID检索图像
我想通过id检索机器映像,但问题是我将获取所有机器映像,而不是特定的一个。所以请告诉我我做错了什么Php 根据mysqli中的ID检索图像,php,mysqli,Php,Mysqli,我想通过id检索机器映像,但问题是我将获取所有机器映像,而不是特定的一个。所以请告诉我我做错了什么 <?php $query1=mysqli_query($con,"select * from photo where m_id = $m_id"); while($row=mysqli_fetch_array($query1)){ ?> <img
<?php
$query1=mysqli_query($con,"select * from photo where m_id = $m_id");
while($row=mysqli_fetch_array($query1)){
?>
<img src="<?php echo $row['location']; ?>" height="150px;" width="150px;">
<?php
}
?>
“高度=“150px;“width=”150px;">
您应该使用WHERE来过滤数据,以便仅获取某些行。只需添加:
$m_id = $_POST['m_id'];
$query1=mysqli_query($con,"select * from photo where m_id = $m_id ");
希望这有帮助