If rowCount > 5 stop the loop PDO PHP

QuestionsIf rowCount > 5 stop the loop PDO PHP
sethbeckerman5 Staff asked 4 years ago

I'm working with PDO and I want to loop database records in an array.

currently returns 7 (I have only 7 input at my table). The main thing is I want my user to display only 5 of the newest records something like pagination but not. Is there an easy way to do that?
I tried loop but it didn't work (or I couldn't do it properly)

I'm really confused at the moment… How do I define as or does it even work? Because it doesn't make sense when you think about it.


View on Stack Overflow