Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: loop set table

  1. #1
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts

    loop set table

    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.

    PHP Code:
        <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>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,858
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •