PHP读取mysql中图片的有关问题

WBOY
Release: 2016-06-13 12:56:56
Original
794 people have browsed it

PHP读取mysql中图片的问题

<?php<br />
// pic_database_output.php By Bleakwind<br />
header( "content-type: image/gif");<br />
$Host = "localhost";<br />
$User = "root";<br />
$Password = "";<br />
$Database = "mycicel";<br />
<br />
mysqli_connect($Host,$User,$Password) or die("Could not connect:" . mysqli_error());<br />
mysqli_select_db($Database) or die("Could not select database!");<br />
<br />
$sql= "SELECT userbase_head FROM `userbase_tables` WHERE `userbase_id`=1";<br />
$result = mysqli_query($sql) or die("Could not perform query!");<br />
$row = mysqli_fetch_array($result);<br />
echo $row['userbase_head'];<br />
?><br />
Copy after login

通过mysqli无法获得图片,说的是因其本身有错无法显示

<?php<br />
// pic_database_output.php By Bleakwind<br />
header( "content-type: image/gif");<br />
$Host = "localhost";<br />
$User = "root";<br />
$Password = "";<br />
$Database = "mycicel";<br />
<br />
mysql_connect($Host,$User,$Password) or die("Could not connect:" . mysql_error());<br />
mysql_select_db($Database) or die("Could not select database!");<br />
<br />
$sql= "SELECT userbase_head FROM `userbase_tables` WHERE `userbase_id`=1";<br />
$result = mysql_query($sql) or die("Could not perform query!");<br />
$row = mysql_fetch_array($result);<br />
echo $row['userbase_head'];<br />
?><br />
Copy after login

这段代码可以成功获取,请教大家这是为什么,要通过mysqli应该如何写

php mysql
------解决方案--------------------
先将header注释掉,看报什么错了。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!