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 6 of 6

Thread: PHP Help

  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Help

    Hi, I'm having some trouble with my PHP code and thought I should come over here. I've been watching the show for a while and never really looked at the forum.
    Anyway, here we go.
    PHP Code:
    <?PHP
    for ($x 0$x sizeof($members['MemberName']); $x++) 
            {
                echo 
    "<a href='logs/".$members[$x]["MemberName"].".html'>".$members[$x]["MemberName"]."</a><br>";
                 }
    ?>
    it doesnt return anything with this data in the members array
    PHP Code:
    Array
    (
        [
    0] => Array
            (
                [
    MemberName] => willmaster
                
    [MemberUserID] => 290668
                
    [MemberKeys] => 6872
                
    [MemberClicks] => 6450
                
    [MemberManager] => No
                
    [MemberCountry] => Canada
            
    )

        [
    1] => Array
            (
                [
    MemberName] => munktube1
                
    [MemberUserID] => 290672
                
    [MemberKeys] => 6998
                
    [MemberClicks] => 1174
                
    [MemberManager] => Yes
                
    [MemberCountry] => Unknown
            
    )

        [
    2] => Array
            (
                [
    MemberName] => ajvpot
                
    [MemberUserID] => 290674
                
    [MemberKeys] => 8437
                
    [MemberClicks] => 4086
                
    [MemberManager] => Yes
                
    [MemberCountry] => United States
            
    )


    Any ideas? Or am i just stupid and forgot something ovbious?

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    a stab in the dark mate but try 'count' instead of 'sizeof' ? not sure if it will work but its worth a shot

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope im starting to get mad at dreamweaver

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Code:
    <?PHP
    foreach($members as $member) 
    {
        echo '<a href="logs/'.$member['MemberName'].'.html">'.$member['MemberName'].'</a><br>';
    }
    ?>

  • #5
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh nevermind, i had to change
    PHP Code:
    for ($x 0$x sizeof($members['MemberName']); $x++) 
    to
    PHP Code:
    for ($x 0$x count($members); $x++) 

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    glad you sorted it mate


  •  

    Posting Permissions

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