欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-05-10 19:14:32
...

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

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'];
     }
   ?>

回复内容:

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

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'];
     }
   ?>

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

name字段不存在,改为reid

相关标签: php