Start new line in php mysql query after 4 results

Hello, I am trying to see if this has been asked already but I am having trouble with wording.

I would like to call a query and display the results of all the people in a database, The trouble I am having is that I would love to have this display in 4 x 4 instead of a new line every name. I tried to use a count query but I got it way wrong. Here is my code I am using at the moment. Thank you
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$athID = $rowA[‘ath_id’];
$athFname = $rowA[‘ath_firstname’];
$athlname = $rowA[‘ath_lastname’];
$ath_Display .= “”.$athFname." “.$athlname.”

This is what I want
UserA UserB UserC UserD
UserE UserF UserG UserH

Instead of

I have solved it, I never thought to keep a count on files and break on every 4th or 5th depending on my needs.

Sponsor our Newsletter | Privacy Policy | Terms of Service