Difference between fetch and fetchAll in PDO

Solved
Hello,
I would like to know the difference between fetch and fetchAll.
Thank you.

1 answer

  1. Contributor
    Hello,

    If I remember correctly: fetch will only return the first response to your query in an array, while fetchAll will return all the responses.

    In other words: fetch will create an array with just one row, while fetchAll will create an array containing as many rows as there are responses.

    --
    Until we try, we won't know.
    27
    1. Okay
      Thank you
      0
    2. thank you
      0