因此,我正在执行一个赞助管理网站,然后我遇到了一些麻烦。 我知道,将图像储存到数据库中可能会在颈部造成这种痛苦,但需要这样做(禁止制作一个档案系统,储存校园服务器中的图像)。
我设立了3个表格:
- a info table storing text information,
- an image table storing images in BLOB fashion and
- a id_table table as a reference table keeping records of image id and info id.
$result=mysql_query("SELECT info_id,info_name,info_year,info_level,info_email,info_describe FROM info");
while($row = mysql_fetch_array($result))
{
echo "<td>" . $row[ info_name ] . "</td>";
echo "<td>" . $row[ info_year ] . "</td>";
echo "<td>" . $row[ info_level ] . "</td>";
echo "<td>" . $row[ info_email ] . "</td>";
echo "<td>" . $row[ info_describe ] . "</td>";
$result_image_id = mysql_query("SELECT id_image FROM id_table WHERE id_info = {$row[ info_id ]} ");
$row_image = mysql_fetch_array($result_image_id);
$result_image = mysql_query("SELECT image_stuff FROM image WHERE image_id = {$row_image[ id_image ]} ");
$row_2 = mysql_fetch_array($result_image);
$content=$row_2[ image_stuff ];
echo "<td>" ;
header( Content-type: image/jpeg );
echo $content;
echo "</td>";
echo "</tr>";
}
Then in the browser, I was redirected to a blank page. If I delete that header function, I do have a table in the page but there is nothing in the image column.
任何建议?
Additionally, I tried using an <img>
tag in my while loop:
echo "<img src= $content />";
好消息是,这种新闻是编造的,但图像档案实际上没有显示。
我的网页上有一个带有图像档案的图像栏的表格,但像服务器一样看不到图像。
I guess there does not exist any problem with my insert script because when I was applying that img tag,the "cannot display" logo only appeared in the cell whose row is the one I did upload image file into database...