Jump to content

making a loop


zhshero

Recommended Posts

Hey i'm just wanting to make a loop to loop members i do have a loop but im looking for a more better loop

i need to loop my members in a table as

 

spot: 1  spot: 2 spot: 3 spot 4

and if there more it puts in below the top for spots and so on

 

$Members = mysql_query("SELECT * FROM users") or die(mysql_error());

$numRowsMembers = mysql_num_rows($Members);
?>

<?php
     for($count = 1; $count <= $numRowsMembers; $count++)
         {

    $name = mysql_fetch_array($Members);

?>

<td width="150" height="125">
<a href="view_profile.php?username=<? echo $name['Username']?>"><img src="<? echo $name['main_P']?>" width="100" height="100"/>
<? echo $name['Username']?></a>

<? } ?>

Link to comment
https://forums.phpfreaks.com/topic/219446-making-a-loop/
Share on other sites

$Members = mysql_query("SELECT * FROM users") or die(mysql_error());

 

$numRowsMembers = mysql_num_rows($Members);

?>

 

<?php

    while($name = mysql_fetch_array($Members)){

 

?>

 

<td width="150" height="125">

<a href="view_profile.php?username=<? echo $name['Username']?>"><img src="<? echo $name['main_P']?>" width="100" height="100"/>

<? echo $name['Username']?></a>

 

<? } ?>

Link to comment
https://forums.phpfreaks.com/topic/219446-making-a-loop/#findComment-1137906
Share on other sites

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.