dongyinting3179 2016-08-10 10:28
浏览 54
已采纳

我的JavaScript脚本不会在php中回显

i have a ads script which i stored in my database using textarea field. but when i echo that script in php. then it will not working. this is my script which i saved in database by using textarea field.

<script type="text/javascript">
  ( function() {
  if (window.CHITIKA === undefined) { window.CHITIKA = { 'units' : [] }; };
  var unit = {"calltype":"async[2]","publisher":"seeknfameads","width":300,"height":250,"sid":"Chitika Default","color_site_link":"337ab7","color_text":"337ab7"};
  var placement_id = window.CHITIKA.units.length;
  window.CHITIKA.units.push(unit);
  document.write('<div id="chitikaAdBlock-' + placement_id + '"></div>');
  }());
</script>
<script type="text/javascript" src="//cdn.chitika.net/getads.js" async></script>

And when i fetch field and try to echo this. it is not working.

  $sql4 = "SELECT * FROM abc ORDER BY id DESC LIMIT 1";
            $query4 = $conn->query($sql4);
            $row4 = $query4->fetch(PDO::FETCH_ASSOC);
            $video_des=$row4['video_des'];
            $rowc = $query4->rowCount(PDO::FETCH_ASSOC);
            if ($rowc>=1){
            <script><?php echo $video_des;?></script>
            }

please help to fix this problem.

  • 写回答

2条回答 默认 最新

  • duanqiang7631 2016-08-10 10:43
    关注

    As you are already inserting value of video_des with <script> and </script> tag

    You don't need to add <script> tag again, Please try below.

     $sql4 = "SELECT * FROM abc ORDER BY id DESC LIMIT 1";
            $query4 = $conn->query($sql4);
            $row4 = $query4->fetch(PDO::FETCH_ASSOC);
            $video_des=$row4['video_des'];
            $rowc = $query4->rowCount(PDO::FETCH_ASSOC);
            if ($rowc>=1){
              echo $video_des;
            }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名