我正在尝试从数据库中显示图像,但是它的工作方式与我的预期无关。我试图理解为什么,但我没有...图像没有被显示,而是我得到了很多随机的乱码。
这是我在页面顶部的php:
<?php
if (is_resource($browse)) mysql_free_result($browse);
?>
<?php require_once('Connections/clubbit.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_browse = 12;
$pageNum_browse = 0;
if (isset($_GET['pageNum_browse'])) {
$pageNum_browse = $_GET['pageNum_browse'];
}
$startRow_browse = $pageNum_browse * $maxRows_browse;
mysql_select_db($database_clubbit, $clubbit);
$query_browse = "SELECT * FROM images";
$query_limit_browse = sprintf("%s LIMIT %d, %d", $query_browse, $startRow_browse, $maxRows_browse);
$browse = mysql_query($query_limit_browse, $clubbit) or die(mysql_error());
$row_browse = mysql_fetch_assoc($browse);
if (isset($_GET['totalRows_browse'])) {
$totalRows_browse = $_GET['totalRows_browse'];
} else {
$all_browse = mysql_query($query_browse);
$totalRows_browse = mysql_num_rows($all_browse);
}
$totalPages_browse = ceil($totalRows_browse/$maxRows_browse)-1;
?>
&#13;
这是我尝试用来显示图片的表格:
<section class="sectionFull">
<h1>Browse Clubs</h1>
<section class="sectionClubs">
<div class="thumbnail">
<form method="POST" name="clubs" id="clubs">
<?php do { ?>
<img src='<?php echo $row_browse['image']; ?>' />
<?php } while ($row_browse = mysql_fetch_assoc($browse)); ?>
<input name="imageID" type="hidden" id="imageID" value="<?php echo $row_browse['imageID']; ?>">
</form>
</div>
</section>
</section>
&#13;
我在数据库中有一个图像,但结果是图像没有显示,并且下面出现了一堆奇怪的字符。
任何帮助都会很棒。 感谢