Results 1 to 3 of 3

Thread: Show Status Of Members

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #2
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    if you add something like a status column in the mysql you could do something like this

    PHP Code:
    <?php
    //here is what username is under the cookie
    $username $_COOKIE['YOUR USERNAME COOKIE GOES HERE'];

    //here gets the info from the table
    $check mysql_query("SELECT * FROM (PLACE YOUR TABLE NAME without parenthesis) HERE WHERE username = '$username'") or die(mysql_error());
    while(
    $info mysql_fetch_array$check )) {
    //now we set $status to equal what there status is on the table
    $status $info['status']
    //now we print there username and status in parenthesis behind it
    echo $username."(".$status.")";

    }
    ?>
    to make it possible for you to change it would be easy as well, let me know if you want that too

  3. #3
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, Assuming you are using MySQL, You would want to query the DB to Select all the records that show an associated status, then count those records and assign the count to a variable. Then just echo the word and the variable.

    As an example:

    Code:
    <?php
    $query_Recordset1 = "SELECT * FROM users WHERE userstatus = 'A'";
    $Recordset1 = mysql_query($query_Recordset1, <db connection variable here>) or die(mysql_error());
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    
    echo("Approved = ". $totalRows_Recordset1);
    ?>
    This is a simplistic method, but effective . You would probably want to put this through a while loop to reiterate it for every option, but that's a bit more complicated.

Bookmarks

Posting Permissions

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