Page 1 of 1

New line after x amount of records(Solved)

Posted: Wed Jun 09, 2010 4:11 pm
by jefffan24
I want to create a link break (or if in a table create a new row) after x amount of records.

I would be using a while loop like:

$sql = "SELECT * FROM blah";
$query = mysql_query($sql);
while($result = mysql_fetch_assoc($query)){
echo $result['name'];
//After every 3rd record create a new line
}

Re: New line after x amount of records(Solved)

Posted: Wed Jun 09, 2010 6:54 pm
by jefffan24
I got it thanks I did

$count = 0;
while(blah blah){
if($count == 2){
echo "<br />";
$count = 0;
}

blah blah

}

It works :p thanks all.