Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的代码无法显示数据库中的图片?_Php - Fatal编程技术网

Php 我的代码无法显示数据库中的图片?

Php 我的代码无法显示数据库中的图片?,php,Php,当我使用php时,请帮助无法显示图像 $result = mysql_query("SELECT * FROM obs") or die(mysql_error()); echo "<center><table><tr><th width=200>Obs Number</th><th width=200>Name</th><th width=200>Purpose</th><th w

当我使用php时,请帮助无法显示图像

$result = mysql_query("SELECT * FROM obs") or die(mysql_error());
echo "<center><table><tr><th width=200>Obs Number</th><th width=200>Name</th><th width=200>Purpose</th><th width=200>Date Of OB</th><th width=200>Destination</th><th width=200>Image</th></tr></center>";
while ($row = mysql_fetch_array($result)) {
    echo '<tr>';

    //cant display image

    echo '<tr> <input type="hidden" name="showimage[]" value="'. $row['OBS_NUMBER'].'" >';
    echo '<td width=200>' . $row['OBS_NUMBER'] . '</td>';
    echo '<td width=200>' . $row['NAME'] . '</td>';
    echo '<td width=200>' . $row['PURPOSE'] . '</td>';
    echo '<td width=200>' . $row['DATE_OF_OB'] . '</td>';
    echo '<td width=200>' . $row['DESTINATION'] . '</td>';
    echo '<td width=200> <img src="data:image/jpeg;base64,' . base64_encode($row['imagesobs']) . '" width="250"></td>';
    echo '</tr>';
}
$result=mysql\u query(“从obs中选择*”)或die(mysql\u error());
回显“Obs编号目标图像的目的日期”;
while($row=mysql\u fetch\u数组($result)){
回声';
//铁路超高显示图像
回声';
回显'.$row['OBS_NUMBER'].';
回显'.$row['NAME'].';
回显“.$row['PURPOSE']”;
回显“.$row['DATE'u OF'u OB']”;
回显'.$row['DESTINATION'].';
回声';
回声';
}

function displayimage(){$con=mysql\u connect(“localhost”、“root”和“”);mysql\u select\u db(“公司人员”\u order\u for\u 2016”,$con);$qry=“select*from obs where obs\u NUMBER='showimage';$result=mysql\u query($qry,$con);while($row=mysql\u fetch\u数组($result)){echo';}mysql_close($con);}如果我使用mysql insert,图片将显示,但当我使用php插入时,它无法显示图像需要您显示如何编码图像..在您的img src上,它不应该是base64_decode吗?echo'';我的意思是encode..base64_encode完成后,您可以将数据保存在db上..因此,当您想要显示它时,您可以使用base64_decode.试试changin把它解码……也许这就是问题所在。