0
我有兩個表用戶和圖像表我只想選擇圖像表和用戶表中的個人檔案圖片,我可以選擇3個字段。我嘗試使用內部連接,但我看不到任何圖像顯示,並沒有錯誤。波紋管是我的代碼如何從兩個表格中進行選擇,並只顯示一個表格中的一個項目和第二個表格中的多個項目?
<?Php
$target = "image_uploads/";
$image_name = (isset($_POST['image_name']));
$query ="select * from
tish_user inner join tish_images
on tish_user.user_id = tish_images.user_id";
$result= $con->prepare($query);
$result->execute();
$table = <<<ENDHTML
<div style ="text-align:center;">
<h2>Client Review Software</h2>
<table id ="heredoc" border ="0" cellpaddinig="2" cellspacing="2" style = "width:100%" ;
margin-left:auto; margin-right: auto;>
<tr>
<th>Name</th>
<th>Last Name</th>
<th>Ref No</th>
<th>Cell</th>
<th>Picture</th>
</tr>
ENDHTML;
while($row = $result->fetch(PDO::FETCH_ASSOC)){
$date_created = $row['date_created'];
$user_id = $row['user_id'];
$username = $row['username'];
$image_id = $row['image_id'];
#this is the Tannery operator to replace a pic when an id do not have one
$photo = ($row['image_name']== null)? "me.png":$row['image_name'];
#display image
$table .= <<<ENDINFO
<tr>
<td><a href ="client_details.php?user_id=$user_id">$username </a></td>
<td>$image_id</td>
<td></td>
<td>c</td>
<td><img src="'.$target.$photo.'" width="100" height="100">
</td>
</tr>
ENDINFO;
}
?>
請提供表結構,一些樣本的數據和預期的結果 – 2013-02-21 14:26:16
@FathahRehmanP確定可以使簡單我想從tish_images tish_user和IMAGE_NAME用戶名,這是要顯示 – humphrey 2013-02-21 14:31:29
如果您提供創建的表腳本形象這兩個表,那將是非常有用的 – 2013-02-21 14:36:32