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?