各位开发者您好!我正在尝试从我的数据库中检索图像以将其包含在我创建的这个表中。我在 Google 上查找的所有示例都是从仅包含图像的 1 个表中检索图像,但在这种情况下,我无法使其正常工作。
<?php
$Con = mysql_connect('localhost','root','');
if($Con === false)
{
echo "Not Connected";
}
else
{
$select = mysql_select_db("symfony");
$TableName = "main";
$SQLstring = "SELECT * FROM $TableName ";
$QueryResult = mysql_query($SQLstring);
$Row = mysql_fetch_row($QueryResult);
do {
echo "<div class='art-content-layout'>";
echo "<div class='art-content-layout-row'>";
echo "<div class='art-layout-cell' style='width: 33%'>";
echo" <p><img width='259' height='194' class='art-lightbox' name='image' src='../images/3.jpg'><br></p>";
echo "</div>";
echo "<div class='art-layout-cell' style='width: 67%'>";
echo "<p></p>";
echo "<table border>";
echo "<tbody>";
echo "<tr>";
echo "<tr>";
echo "<th colspan='3' align='left'><b> Owner : $Row[0]</b></th>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='3'><b>$Row[1]:</b>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>Price:$Row[9] US Dollar </b></td>";
echo "</tr>";
echo "<tr>";
echo "<td><b> City: $Row[4] </br> Hood: $Row[4] </br> Qdr: $Row[5] </br> Street:$Row[6] </br> Property Number :$Row[7] </br> Room Number : $Row[8] </b></td>";
echo" <td><b>Description : $Row[10] </b></td>";
echo "</tr>";
echo"<tr>";
echo" <td><b>Type : $Row[12] </b></td>";
echo "<td><b>Contact : $Row[1] </b></td>";
echo "</tr>";
echo "</tr>";
echo "</tbody>";
echo "</table> <br><p></p>";
echo "</div>";
echo "</div>";
echo "</div>";
$Row = mysql_fetch_row($QueryResult);
} while ($Row);
}
?>
我试图这样做,它仍然没有工作:
$img = $Row[15];
//column 15 is the Blob the image
$img = mysql_fetch_array($QueryResult);
$content = $img['15'];
//header('Content-type: image/jpg');