【问题标题】:display images stored in SQL database显示存储在 SQL 数据库中的图像
【发布时间】:2014-09-06 20:30:26
【问题描述】:

我已使用文本框将图像存储到 SQL 数据库并将其存储在数据库中,我如何从数据库中检索图像。我使用以下代码显示但它不起作用

// Grab the data from our people table
$sql = "select * from upload";
$result = mysql_query($sql) or die("Could not access DB: " . mysql_error());

while ($row = mysql_fetch_assoc($result)) {
  echo "<div class=\"picture\">";
  echo "<p>";

  // Note that we are building our src string using the filename from the database
  echo "<img src=$row['data']/>";
  echo $row['title'] . " " . $row['title'] . "<br />";
  echo "</p>";
  echo "</div>";
}

【问题讨论】:

标签: php sql database image forms


【解决方案1】:

以下链接可能对您有所帮助。

PHP- Image upload to MySQL

设置数据列的 blob 类型。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-17
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多