Skip to content
Advertisement

How to retrieve all rows from an SQL table into an array?

I am trying to retrieve 4 rows and I expected that It should display all 4 rows but it’s only displaying the first row. This is the code I am using

Advertisement

Answer

If you want to get all rows from the result set then you need to fetch all. Right now you are fetching only one.

To fetch all rows use fetch_all()

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement