0

I have the following function which I expect to return an array with all rows in the table matching the condition (in my case 2 rows). The username is passed and so is the connection (both tested with hard-coding requirements) and still I get an integer return that's 1.

How can I return the array with all rows matching condition:

function getPendingOrdersForUser($username, $connection)
  {
    $ordersQuery = "SELECT * FROM orders at WHERE at.username=:username;";
    $stmt = $connection->prepare($ordersQuery);
    $stmt->execute(array(':username' => $username));
    $result = !!$stmt->fetchAll(PDO::FETCH_ASSOC);
    return $result;
  }

Thanks,

ksjg
  • 5
  • 3

0 Answers0