-1

我已经将图像添加到数据库中,使用目录路径作为一行中的一个字段,并将文件扩展名作为一行中的另一个字段。

表代码:

CREATE TABLE chinaletting (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    category TEXT NOT NULL,
    title TEXT NOT NULL,
    image BLOB NOT NULL,
    imageext TEXT NOT NULL,
    floorroom TEXT NOT NULL,
    spacesize TEXT NOT NULL,
    available TEXT NOT NULL,
    contactname TEXT NOT NULL,
    contactnumber TEXT NOT NULL,
    email VARCHAR(32) NOT NULL DEFAULT 'noemail@test.com'
);
CREATE INDEX "id" ON "chinaletting" ("id");

表格显示:

<dl>
    <?php foreach ($this->entries as $entry): ?>
    <dt><?php echo $this->escape($entry->category) ?></dt>
    <dd><?php echo $this->escape($entry->title) ?></dd>
    <dd><?php echo $this->escape($entry->image), $this->escape($entry->imageext)  ?></dd>
    <dd><?php echo $this->escape($entry->floorroom) ?></dd>
    <dd><?php echo $this->escape($entry->spacesize) ?></dd>
    <dd><?php echo $this->escape($entry->available) ?></dd>
    <dd><?php echo $this->escape($entry->contactname) ?></dd>
    <dd><?php echo $this->escape($entry->contactnumber) ?></dd>
    <dd><?php echo $this->escape($entry->email) ?></dd>
    <?php endforeach ?>
</dl>

在屏幕上显示:

在此处输入图像描述

真正要显示的是图片谁能帮忙

4

1 回答 1

0

尝试:

<dl>
    <?php foreach ($this->entries as $entry) {
      if($this->escape($entry->category) == 'pacific') { ?>
        <dt><?php echo $this->escape($entry->category) ?></dt>
        <dd><?php echo $this->escape($entry->title) ?></dd>
        <dd><img src="<?php echo $this->escape($entry->image), $this->escape($entry->imageext)  ?>"></dd>
        <dd><?php echo $this->escape($entry->floorroom) ?></dd>
        <dd><?php echo $this->escape($entry->spacesize) ?></dd>
        <dd><?php echo $this->escape($entry->available) ?></dd>
        <dd><?php echo $this->escape($entry->contactname) ?></dd>
        <dd><?php echo $this->escape($entry->contactnumber) ?></dd>
        <dd><?php echo $this->escape($entry->email) ?></dd>
    <?php }} ?>
</dl>

对于 2 个类别:

<dl>
    <?php foreach ($this->entries as $entry) {
      if($this->escape($entry->category) == 'shoes' || $this->escape($entry->category) == 'dress') { ?>
        <dt><?php echo $this->escape($entry->category) ?></dt>
        <dd><?php echo $this->escape($entry->title) ?></dd>
        <dd><img src="<?php echo $this->escape($entry->image), $this->escape($entry->imageext)  ?>"></dd>
        <dd><?php echo $this->escape($entry->floorroom) ?></dd>
        <dd><?php echo $this->escape($entry->spacesize) ?></dd>
        <dd><?php echo $this->escape($entry->available) ?></dd>
        <dd><?php echo $this->escape($entry->contactname) ?></dd>
        <dd><?php echo $this->escape($entry->contactnumber) ?></dd>
        <dd><?php echo $this->escape($entry->email) ?></dd>
    <?php }} ?>
</dl>
于 2012-08-20T16:00:57.497 回答