I am trying to display names from my database on a page where it list 5 names in 5 colums in 1 row and then after 5 names it moves to the next row, but I can't get past either having 1 name per row or having all the names on 1 row.
I want this-
|name|name|name|name|name|
|name|name|name|name|name|
|name|name|name|name|name|
and so on
All I can get is
|name||name||name||name||name||name||name||name||name||name||name||name||name||name||name||name||name|
OR
|name____________________|
|name____________________|
|name____________________|
My code is:
while ($col = mysql_fetch_array ($Result)) { echo'<td width="20%" background="url">';
echo ("<A HREF=\"membersearch.php?user_name=".urlencode($col["user_name"])."\">$col[user_name]</A></td>");
Ive tried a for loop making it input a </tr> every 5 names but that just does 1 name per line and then adds the </tr> because it runs the whole for loop in the while. I also tried having another for loop over the while which didn't work either. I can't think of how to get it to go to a new row after 5 names have been extracted. Does anyone have an idea of how I can do this?
Thanks a lot for any help.