如何在保存为Mysql的Mysql中显示网页图片?
|
所以我在HTML中有以下代码:
<img src=\"imagescript.php?id=1\">
我在imagescript.php中有以下代码:
<?php
$servername=\"localhost\";
$username=\"root\";
$conn= mysql_connect($servername,$username)or die(mysql_error());
mysql_select_db(\"licitatii\",$conn);
$sql=\"select picture from auctions where auction_id=\'$_GET[id]\'\";
$result=mysql_query($sql,$conn) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$image = $row[\'picture\'];
header(\"Content-type: image/jpeg\");
print $image;
?>
我从互联网上的说明中使用了此图片,但是我的图片没有显示。
我是否可能错误地上传了图像?
我以方法= \“ POST \”的形式使用<输入名称= \“ regphoto \”类型= \“文件\”>,然后将$ _POST [regphoto]插入表中
如果有帮助,请点击提交按钮后,使用以下php脚本插入照片:
$ sql = \“插入拍卖(auction_id
,owner_id
,parent_category_id
,title
,description
,picture
,postage
,starting_price
,buyout_price
,end_date
)值(NULL,\'$ ownerid \',\'$ parentcategoryid \',\'$ _POST [regtitle] \',\'$ _ POST [regdescription] \',\'$ _ POST [regphoto] \',\'$ _ POST [regpostage] \',\'$ _ POST [regstartingprice] \',\'$ _POST [regbuyoutprice] \',\'$ expiration \')\“;
如您所见,我在\“ picture \”列(类型mediumblob)中插入了值$ _POST [regphoto]
没有找到相关结果
已邀请:
1 个回复
版萍层分
并在查询中使用
。 您还必须张贴用于插入图像的php代码,因为插入
听起来是错误的:您需要
,这是一个数组,请参见手册。