希望存储和检索数据库中的数据,包括图像,能够存储图像,但由于isset()错误而无法显示。
以下是我使用过的文件。
<img src=get.php?id=$lastid>和$_REQUEST在这个文件中。控制流没有通过isset()创建问题。$image=mysql_query(“从id=$mid的用户数据中选择*”)或死(“无效查询:”)。Mysql_error();$image=mysql_fetch_assoc($image);$ $image=$image'image';header("Content-type: image/jpeg");echo $image;} else { echo"error";} ?>
发布于 2015-04-19 17:10:08
这是我第一次在讨论论坛上发布任何内容,问题应该是,这段代码可能有什么问题:
$lastid=mysql_insert_id();//get the id of the last record
echo "<img src='get.php?id=".$lastid."'>";其中get.php是:
<?php
#connection to db
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db("wordgraphic")or die(mysql_error());
if(isset($_REQUEST['id']) ) > this block of code is not runninng
{
$mid=(int)($_REQUEST['id']);
$image=mysql_query("SELECT * FROM userdata WHERE id=$mid") or die("Invalid query: " . mysql_error());
$image=mysql_fetch_assoc($image);
$image=$image['image'];
header("Content-type: image/jpeg");
echo $image;
}
else
{
echo"error";
}
?>https://stackoverflow.com/questions/29732701
复制相似问题