Home > Backend Development > PHP Tutorial > 我这个代码为什么打印不出来数据呢?

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

WBOY
Release: 2016-06-06 20:18:04
Original
1301 people have browsed it

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>
Copy after login
Copy after login

回复内容:

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>
Copy after login
Copy after login

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

name字段不存在,改为reid

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template