...

View Full Version : loop set table



slappyjaw
10-18-2009, 09:43 PM
Hey i was wondering if there is any way that you could loop through a table with results from a query. I have tried but i cant find out how to set a numer or rows and colums. Like i want it to be a table that is 7 X 7. Here is my code so far.


<table><tr>
<?php if($num_friends < 1){echo "<br/>Your currently have no friends to display.";}else{
while($info = mysql_fetch_array($result)) {
$sql = "SELECT * FROM users WHERE users_username = '".$info['friend_friend']."'";
$result_info = mysql_query($sql) or die(mysql_error());
$friend_info = mysql_fetch_assoc($result_info);
?>
<td>
<?php if($friend_info['users_defaultpic'] == "none.jpg"){?>
<a href="profile.php?username=<?php echo $friend_info['users_username']?>"><img src="site_pictures/none.jpg" width="130" height="105" alt=""></a>
<?php }else{?>
<a href="profile.php?username=<?php echo $friend_info['users_username']?>"><img src="./user_uploads/<?php echo $friend_info['users_id']?>/<?php echo $friend_info['users_defaultpic']?>" width="130" height="105" alt=""></a>
<?php }?>
<br>
<a href="profile.php?username=<?php echo $friend_info['users_username']?>"><?php echo $friend_info['users_username']?></a>
</td>
<?php
}
}?>
</table>

abduraooft
10-19-2009, 09:35 AM
Take a look at http://www.codingforums.com/showthread.php?t=129466



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum