douyu9159 2016-03-31 17:46
浏览 110
已采纳

获取blob图像中的解析错误(php)[重复]

This question already has an answer here:

I was trying to fetch blob image from database after trying a lot and doing many changes in code I cant resolve this error. I have bold that line in my code. If I remove that tag code works but with that tag I get an error. Why this error is occuring and what is the solution. //error Parse error: syntax error, unexpected 'data' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\project\DBMS\index.php on line 18

<html>
<?php

require "connect.php";

  $sql="select * from newbook";
$row = $conn->query($sql);
$n=0;
echo"<form method='post'><table border='0' align='center'><tr>";
    while($arr = $row->fetch_assoc()) 
    {
           $i=$arr['BookId'];
    if($n%4==0)
    {
    echo "<tr>";
    }
   echo "
    **<td height='280' width='240' align='center'><img src="data:image/jpeg;base64,'.base64_encode( $arr['BookImage'] ).'"height='200' width='200'><br/>**
    <b>BOOKNAME:</b>".$arr['BOOKNAME'].
   "<br><b>Author:</b>".$arr['Author'].
   "<br><b>Publication:</b>&nbsp;".$arr['PublicatonHouse'].
   "<br><b>Discount:</b>".$arr['Discount']."%".
   "<br><br><img src='images/MetalPlakDa5new.gif' width='70' height='20'/></a>
   <img src='images/view7.jpg' width='70' height='20'/></a>
   </td>";
  $n++;
    }




      echo "</tr></table>
       </form>";
    ?>

</body>
</html>
</div>
  • 写回答

2条回答 默认 最新

  • dongyilu3143 2016-03-31 17:49
    关注

    Well, your quotes are all in the wrong order, do it's trying to parse text as PHP.

    <html>
    <?php
    
    require "connect.php";
    
      $sql="select * from newbook";
    $row = $conn->query($sql);
    $n=0;
    echo"<form method='post'><table border='0' align='center'><tr>";
        while($arr = $row->fetch_assoc()) 
        {
               $i=$arr['BookId'];
        if($n%4==0)
        {
        echo "<tr>";
        }
       echo "
        **<td height='280' width='240' align='center'><img src='data:image/jpeg;base64,".base64_encode( $arr['BookImage'] )."'height='200' width='200'><br/>**
        <b>BOOKNAME:</b>".$arr['BOOKNAME']."
       <br><b>Author:</b>".$arr['Author']."
       <br><b>Publication:</b>&nbsp;".$arr['PublicatonHouse']."
       <br><b>Discount:</b>".$arr['Discount']."%
       <br><br><img src='images/MetalPlakDa5new.gif' width='70' height='20'/></a>
       <img src='images/view7.jpg' width='70' height='20'/></a>
       </td>";
      $n++;
        }
    
    
    
    
          echo "</tr></table>
           </form>";
        ?>
    
    </body>
    </html>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路