2011-11-08 3 views
0

테이블을 사용하여 데이터베이스에서 자동차 정보를 가져오고이 테이블의 각 열에는 자동차 정보가 있지만 마지막 열에는 내 데이터베이스에 저장되어있는 자동차 그림이 표시됩니다. 이미 가지고 있습니다. 내 코드는 내 데이터베이스에서 그림을 가져오고 브라우저에서 직접 볼 수 있습니다. 하지만 어떻게 새 창에서 사진을 열지 않고도 테이블 열에서 직접 그림을 볼 수 있습니다. 보기 코드테이블에서 가져온 그림보기

while($rows=mysql_fetch_array($result)){ 
?> 
<tr> 
<td class="style1"><?php echo $rows['branch']; ?></td> 
<td class="style1"><?php echo $rows['model']; ?></td> 
<td class="style1"><?php echo $rows['doors']; ?></td> 
<td class="style1"><?php echo $rows['fuel']; ?></td> 
<td class="style1"><?php echo $rows['engine']; ?></td> 
<td class="style1"><?php echo $rows['colo']; ?></td> 
<td class="style1"><?php echo $rows['wheel']; ?></td> 
<td class="style1"><?php echo $rows['condit']; ?></td> 
<td class="style1"><?php echo $rows['warranty']; ?></td> 
<td class="style1" style="width: 47px"><?php echo $rows['price']; ?></td> 
<td class="style1"><?php echo $rows['CarOwner']; ?></td> 
<td align="center" class="style3"><a href="info.php?id=<?php echo $rows['CarOwner']; ?>"><?php echo $rows['CarOwner']; ?></a></td> 
<td align="center" class="style3"><?php echo "download.php"; ?></td> 

와 MySQL

에서이 이미지 다운로드는
<?php 
//$id = $_GET['id']; 
include_once 'D_B.php';// Connect to server and select database. 
$query = "SELECT `name`, `type`, `size`, `content` FROM `upload` WHERE `id`='1'"; 
$result = mysql_query($query) or die('Error, query failed'); 
list($name, $type, $size, $content) =mysql_fetch_array($result); 

header("Content-length: $size"); 
header("Content-type: $type"); 
echo $content; 
exit; 
?> 
+1

을 그렇게하지 이미지의 HTML 태그를 알고 있습니까? –

답변

0

그냥 같이, <img> 태그의 src 속성으로 귀하의 링크의 주소를 사용

<td><img src="image.php?id=<?php echo $rows['imageId']; ?>"/></td> 
관련 문제