douzhi4056 2014-11-07 20:23
浏览 22

查询结果导致PDOStatement错误

I am getting a fairly obvious sounding error in my PHP code: fatal error: Cannot use object of type PDOStatement as array in. But looking at my code, I don't understand why. I have these 2 lines of code:

$orderInfo = get_Order_By_Id($order_id);
echo "<br>".$orderInfo['XYZABC']."-<br>";

Which is calling this function:

function get_Order_By_Id($abc){
  global $db;
  $query = "SELECT * FROM  . . . . WHERE id = ".$abc;
  $results = $db->query($query)->fetch(PDO::FETCH_ASSOC);
  return $results;
}

So I am executing a statement and returning it like I've done a million times…and I'm getting this error? Why? I am executing the statement and trying to the results--why is that throwing this error?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制