Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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_Html_Mysql_Mysqli - Fatal编程技术网

PHP搜索函数不返回图像

PHP搜索函数不返回图像,php,html,mysql,mysqli,Php,Html,Mysql,Mysqli,玩php,还是新手,等等。我的搜索功能开始工作了,它可以很好地恢复所有数据。唯一的问题是,它不会显示我的每个食谱的图像 $count = mysql_num_rows($query); $count = mysql_num_rows($query); if($count == 0) { $output = 'There was mo match!'; }else{ while($row = mysql_fetch_array($qu

玩php,还是新手,等等。我的搜索功能开始工作了,它可以很好地恢复所有数据。唯一的问题是,它不会显示我的每个食谱的图像

    $count = mysql_num_rows($query);
    $count = mysql_num_rows($query);
    if($count == 0) {
        $output = 'There was mo match!';
    }else{
        while($row = mysql_fetch_array($query)){
            $pic = $row['pix'];

            $output .= '
            <div class="panel panel-default">
                <div class="panel-heading"><b>' . htmlentities($rN, ENT_QUOTES) . '</b></div>
                    <div class="panel-body">
                        <div class="pull-left col-xs-12 col-sm-4">
                            <a href="#">
                                <img class="img-thumbnail img-responsive" src="'. htmlentities($pic, ENT_QUOTES) . '">
$count=mysql\u num\u行($query);
$count=mysql\u num\u行($query);
如果($count==0){
$output='存在mo匹配!';
}否则{
while($row=mysql\u fetch\u array($query)){
$pic=$row['pix'];
$output.='
“.htmlentities($rN,ENT_引号)。”
我已经尝试了很多不同的版本等,但正如我所说,我对这一点太陌生了,所以我仍在尝试了解它。所有其他函数都可以正常工作等。不起作用的主要代码是:

<img class="img-thumbnail img-responsive" src="'. htmlentities($pic, ENT_QUOTES) . '">

如果有人能帮我解决这个问题,那就太好了。 谢谢你的帮助


注:我知道sql注入:)但现在一步一步x

根据我的评论和OP的愿望:

src=“”.htmlentities($pic,entu引号)。“
替换为

<img src="data:image/jpeg;base64,'.base64_encode( $pic ).'"/>

因为列类型是BLOB

是一种完全不同的动物,主要用于弦乐

字符串htmlentities(字符串$string[,int$flags=ENT|u COMPAT | ENT|u HTML401[,字符串$encoding=ini_get(“默认字符集”)[,bool$double_encode=true]]


脚注:

mysql.*
函数弃用注意事项:

从PHP 5.5.0开始,此扩展已被弃用,并已从PHP 7.0中删除,因此不建议编写新代码,因为它将在将来删除。相反,应使用或扩展。选择MySQL API时,请参阅以获取更多帮助

这些函数允许您访问MySQL数据库服务器。有关MySQL的更多信息,请访问»


MySQL的文档可以在»找到。

你能给出
$pic
$row['pix']
的示例值吗?
var_dump();
var_dump($row['pix']);
显示了它的内容和值是什么?还要查看你的HTML源代码。另外,不确定你是否应该使用
htmlentities()
此处。旁注:您可以安全地删除其中一行($code>$count=mysql\u num\u rows($query);,您有2x。pix是我在sql中选择的图像database@Fred-请便x@Nevershow2016非常荣幸,干杯:-)不客气。