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条)

报告相同问题?

悬赏问题

  • ¥15 plotBAPC画图出错
  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理