Jump to content

[SOLVED] printing word every 4th row returned


Canman2005

Recommended Posts

Hi all

 

I have a very simple QUERY, looks like

 

<?php
$sql = "SELECT * FROM `users` WHERE `area` = '99'";
$show = @mysql_query($sql,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($show))		
{
print $row['fullname'];
print "<br>";
}
?>

 

This returns a list like

 

David

Harry

Sarah

Richard

Shelly

Bob

Jerry

Vicki

Shaun

 

How is it possible to insert the word "NEXT" after every 4th row returned, so the above output would look like

 

David

Harry

Sarah

Richard

NEXT

Shelly

Bob

Jerry

Vicki

NEXT

Shaun

 

Any help would be great

 

Thanks

 

Ed

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.