PDO Prepare Statent只返回列名,而不返回值


PDO Prepare Statenent is returning only column names instead of values

我编写了一个函数,使用PDO Prepare语句从表中提取列。

但它只返回列名。。

有人能帮忙吗。。

提前感谢

如果你能粘贴一些代码,我们可以提供帮助。典型的PDO示例如下:

<?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";
  }
}
?>

请检查您的代码,让我们了解更多详细信息。