复制代码 代码如下:
if($picture != "none") {
$psize = filesize($picture);
$mysqlpicture = addslashes(fread(fopen($picture, "r"), $psize));
mysql_connect($host,$username,$password) or die("unable to connect to sql server");
@mysql_select_db($db) or die("unable to select database");
mysql_query("insert into images (image) values ($mysqlpicture)") or die("cant perform query");
}else {
echo"you did not upload any picture";
}
//以img标签读取数据库中的图片的代码
复制代码 代码如下:
mysql_connect($host,$username,$password) or die("unable to connect to sql server");
@mysql_select_db($db) or die("unable to select database");
$result=mysql_query("select * from images") or die("cant perform query");
while($row=mysql_fetch_object($result)) {
echo "<img src="second.php3? picnum=$row->picnum">";
//如secoed.php文件代码如下
$result=mysql_query("select * from images where picnum=$picnum") or die("cant perform query");
$row=mysql_fetch_object($result);
header( "content-type: image/gif");
echo $row->image;
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!