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
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Show Status Of Members

    Hi all,

    I am trying to set up a PHP page, I have constructed the database and everything, now just trying to finesse it all. I have a db full of members, they can be Approved, Deleted, On Hold, Pending & Rejected. In the db they are represented respectively A, D, H, P, R. I just want PHP to display the the word assocated e.g. Approved and also the number of members associated. Sorry I am a newbie and just learning, if anyone could give me some insight would be great!

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    PHP Code:
    <?php
    $member_status 
    = array('A' => 'Approved',
                            
    'D' => 'Deleted',
                            
    'H' => 'On Hold',
                            
    'P' => 'Pending',
                            
    'R' => 'Rejected');
    ?>
    And when you list the user's information you would use it like this(assuming $row is the current row, or substitute your user data array):
    PHP Code:
    <?php
    echo $member_status[$row['user_status']];
    ?>
    And to get a count of all users of a certain group you could:
    Code:
    SELECT COUNT(*) FROM `users` WHERE `user_status` = 'A'
    Or select all rows and have php sort them.


  •  

    Posting Permissions

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