2016-05-06 12 views
0

私は償却されたMySQLを使用していることを知っています。ページが非常に重いので、イメージファイルを直接そこに挿入するのではなくデータベースにリンクする必要があります。 それ以外にも、 "image"列のデータベーステーブル "builds"からBLOBイメージを表示するのに問題があります。PHPでテーブルにMySQLデータベースのBLOBイメージを表示

ここに私のコードです:PHPタグの開閉を表示する問題。

PHPMyAdminの画像:enter image description here

ウェブページの表示:助けをenter image description here

include ("connect.php"); 
$conn = mysql_connect("localhost", $id, $pw); //Start of Establishing Connection to Database "akimble" 
if (!$conn) { 
    die ("Error connecting: " . mysql_error()); //Displays What the Error was if Present 
} 
mysql_select_db($db, $conn); 
$sql = "SELECT * FROM builds"; //Selects Everything From the Table "userinfo" in "akimble" Database 
$results = mysql_query($sql, $conn); //Assigning all Data 

echo "<table cellpadding=10 border=1> 
<tr> 
    <th>User ID</th> 
    <th>Image Name</th> 
    <th>Image</th> 
</tr>"; 

while ($entries = mysql_fetch_array($results)) { //Fetch all Information within "results" Variable 
    echo "<tr>"; 
     echo "<td>" . $entries['id'] . "</td>"; 
     echo "<td>" . $entries['name'] . "</td>"; 
     header("Content-type: image/jpg"); 
     echo '<img src="data:image/jpg;base64,' . base64_encode($row['image']) . '" />'; 
    echo "</tr>"; 
               } 
echo "</table>"; 

mysql_close($conn); 

おかげで、私はこの上の時間のために苦労してきました。

+0

を使用するエントリ$という名前の変数へのすべてのmysqlの結果をフェッチしていること

からインデックス画像を得ることができますどのように定義されていませんこのリンクを試してください(http://stackoverflow.com/questions/20556773/php-display-image-blob-from-mysql) – developersaumya

+0

@SaumyaSingh私はこれを試して、私はまだ立ち往生しています。 – Aramza

+0

どのようなエラーや問題に直面しているか教えてください?? – developersaumya

答えて

0

$行は、uはあなたがそう$エントリ[「イメージ」]

echo '<img src="data:image/jpg;base64,' . base64_encode($entries['image']) . '" />'; 
echo "</tr>"; 
関連する問題