PDO Prepare Statenent is returning only column names instead of values

房东的猫 提交于 2019-12-25 08:07:03

问题


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

But its returning only the column names..

Could anyone help..

Thanks in Advance


回答1:


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.



来源:https://stackoverflow.com/questions/9464600/pdo-prepare-statenent-is-returning-only-column-names-instead-of-values

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!