PDO Prepare Statenent仅返回列名而不是值 [英] PDO Prepare Statenent is returning only column names instead of values

查看:63
本文介绍了PDO Prepare Statenent仅返回列名而不是值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个使用PDO Prepare语句从表中获取列的函数.

I have written a function using PDO Prepare Statement to fetch columns from a table.

但是它只返回列名.

任何人都可以帮忙..

Could anyone help..

预先感谢

推荐答案

也许您可以粘贴一些代码,我们可以为您提供帮助.典型的PDO示例如下:

Maybe if you can paste some code we could help. The typical PDO example is like the following:

<?php
function getFruit($conn) {
  $sql = 'SELECT name, color, calories FROM fruit ORDER BY name';
  foreach ($conn->query($sql) as $row) {
    print $row['name'] . "\t";
    print $row['color'] . "\t";
    print $row['calories'] . "\n";
  }
}
?>

请检查您的代码,请让我们知道有关它的更多详细信息.

Check your code and please, let us know more details about it.

这篇关于PDO Prepare Statenent仅返回列名而不是值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆