首页  >  文章  >  后端开发  >  我这个代码为什么打印不出来数据呢?

我这个代码为什么打印不出来数据呢?

WBOY
WBOY原创
2016-06-06 20:18:041256浏览

id也是有值的 数据库里面也有数据 也没有报错的地方为什么就是打印不出来数据呢?
我这个代码为什么打印不出来数据呢?

<code><?php $id2=$_GET['id'];
   $pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
   $stmt=$pdo->prepare("select id,name,content from reply where reid=?");
   $stmt->execute(array($id2));
   $res1=$stmt->fetchall(PDO::FETCH_ASSOC);
    foreach($res1 as $v2){
      echo $v2['content'];
     }
   ?></code>

回复内容:

id也是有值的 数据库里面也有数据 也没有报错的地方为什么就是打印不出来数据呢?
我这个代码为什么打印不出来数据呢?

<code><?php $id2=$_GET['id'];
   $pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
   $stmt=$pdo->prepare("select id,name,content from reply where reid=?");
   $stmt->execute(array($id2));
   $res1=$stmt->fetchall(PDO::FETCH_ASSOC);
    foreach($res1 as $v2){
      echo $v2['content'];
     }
   ?></code>

<code>$stmt=$pdo->prepare("select id,name,content from reply where reid=?");</code>

name字段不存在,改为reid

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn