Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Showing Status Of Members

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

    Default

    I tried this...
    PHP Code:
    $approved 'There are <b>'.$aCount.'</b> members that are Approved';
    $rejected 'There are <b>'.$rCount.'</b> members that are Rejected';
    $onhold 'There are <b>'.$hCount.'</b> members that are On Hold';
    echo 
    $approved
    it echo'ed the statement but without a result...

  2. #12
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Ok, are you using this in a different script than that of mlist.php (the first php script on the first page of this post)? If so, then you will need to use the queries for $aCount and so on. It would look like the following:

    Code:
    //approved
    $a = mysql_query("SELECT * FROM `table` WHERE `MemberApproved`='A'");
    $aCount = mysql_num_rows($a);
    
    //deleted
    $d = mysql_query("SELECT * FROM `table` WHERE `MemberApproved`='D'");
    $dCount = mysql_num_rows($d);
    
    //on hold
    $h = mysql_query("SELECT * FROM `table` WHERE `MemberApproved`='H'");
    $hCount = mysql_num_rows($h);
    
    //pending
    $p = mysql_query("SELECT * FROM `table` WHERE `MemberApproved`='P'");
    $pCount = mysql_num_rows($p);
    
    //not sure
    $n = mysql_query("SELECT * FROM `table` WHERE `MemberApproved`='N'");
    $nCount = mysql_num_rows($n);
    
    //rejected
    $r = mysql_query("SELECT * FROM `table` WHERE `MemberApproved`='R'");
    $rCount = mysql_num_rows($r);
    
    
    
    $approved = "There are '.$aCount.' members that are Approved";
    
    echo $approved;
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    Apologies yes I was going to put it on the page that shows the members, once you click one of the status links...

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

    Default

    Do you know of any way of being able to make the last line work for all of the status areas?
    PHP Code:
    $approved "There are '.$aCount.' members that are Approved"
    , so depending on what status is selected it filled in the appropriate fields of that line? Or do I need to do it spererately?

  5. #15
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You could do it seperatly (spelling?), or use if-then conditionals for this.

    Example:

    Code:
    if ($cat == "A") {
    $field = "Approved";
    $theCount = $aCount;
    }
    
    elseif ($cat == "H") {
    $field = "On Hold";
    $theCount = $hCount;
    }
    
    echo 'There are '.$theCount.' members that are '.$field;
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    I just had to make them lowercase but it works beautifully!
    Code:
    if ($cat == "a") {
    $field = "Approved";
    $theCount = $aCount;
    }
    
    elseif ($cat == "h") {
    $field = "On Hold";
    $theCount = $hCount;
    }

  7. #17
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Great, let us know if you need any more help on this.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    I do want to take it a bit further... I guess the first part which hopefully will be simple. Once you get to the Status > Show Members page I want to have a link, which says 'Download', actually I also want to have a 'Download' link on the mlist.php page but that one would need to be in each cell of the table if you get what I mean? Is this hard... Can you define how it should be saved? I think .xls would be the best course of action... What do you think?

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

    Default

    Sorry I posted a question in the wrong post ha! How would I get the date's here to be back to how they were using this
    PHP Code:
    echo($qry['loginDateTime']?date('d/m/Y H:i:s'strtotime($qry['loginDateTime'])):'unknown'
    ?

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

    Default

    Quote Originally Posted by thetestingsite View Post
    Great, let us know if you need any more help on this.
    Hiya! I tried to add an 'Edit' link, but now it's not displaying anything... Basically the 'Edit ' link when clicked on is meant to change the member from 'MemberStatus' 'A' to 'D'... any ideas?
    PHP Code:
    <?php
    $cat 
    $_GET['cat'];

    /* connect to the mysql database and use a query to get the members info */

    include 'library/config.php';
    include 
    'library/opendb.php';

    //navigation
    include("nav.php");

    //approved
    $a mysql_query("SELECT * FROM `tblmembers` WHERE `MemberApproved`='A'");
    $aCount mysql_num_rows($a);

    //deleted
    $d mysql_query("SELECT * FROM `tblmembers` WHERE `MemberApproved`='D'");
    $dCount mysql_num_rows($d);

    //on hold
    $h mysql_query("SELECT * FROM `tblmembers` WHERE `MemberApproved`='H'");
    $hCount mysql_num_rows($h);

    //pending
    $p mysql_query("SELECT * FROM `tblmembers` WHERE `MemberApproved`='P'");
    $pCount mysql_num_rows($p);

    //not sure
    $n mysql_query("SELECT * FROM `tblmembers` WHERE `MemberApproved`='N'");
    $nCount mysql_num_rows($n);

    //rejected
    $r mysql_query("SELECT * FROM `tblmembers` WHERE `MemberApproved`='R'");
    $rCount mysql_num_rows($r);

    if (
    $cat == "a") {
    $field "Approved";
    $theCount $aCount;
    }

    elseif (
    $cat == "d") {
    $field "Deleted";
    $theCount $hCount;
    }

    elseif (
    $cat == "h") {
    $field "On Hold";
    $theCount $hCount;
    }

    elseif (
    $cat == "p") {
    $field "Pending";
    $theCount $pCount;
    }

    elseif (
    $cat == "n") {
    $field "Not Sure";
    $theCount $nCount;
    }

    elseif (
    $cat == "r") {
    $field "Rejected";
    $theCount $rCount;
    }

    echo 
    'There are '.$theCount.' members that are '.$field;


    if (isset(
    $_GET['del']) AND $_GET['del'] <> "") { 
      
    /* construct and run our "deactivate" query */ 
      
    $query "UPDATE tblmembers SET MemberAPP = 'D' WHERE `MemberID`='" $_GET['del'] ."' LIMIT 1"
      
    $result mysql_query ($query); 


    /* set the allowed order by columns */ 
    $default_sort 'LastName'
    $allowed_order = array ('JoinDate''FirstName','LastName''loginDateTime'); 

    /* if order is not set, or it is not in the allowed 
    * list, then set it to a default value. Otherwise, 
    * set it to what was passed in. */ 
    if (!isset($_GET['order']) OR !in_array ($_GET['order'], $allowed_order)) { 
        
    $order $default_sort
    } else { 
        
    $order $_GET['order']; 


    /* construct and run our query */ 
    $query "SELECT * FROM tblmembers WHERE `MemberApproved`='$cat' ORDER BY $order"
    $result mysql_query ($query); 

    /* make sure data was retrieved */ 
    if (mysql_num_rows($result)) { 
      echo 
    "No data to display!"
    } else { 

      
    /* now grab the first row and start the table */ 
      
    $row mysql_fetch_assoc ($result); 
      echo 
    "<table border=1>\n"
      
    $table_init true
      echo 
    "<TR>\n"
      while (
    $row mysql_fetch_assoc ($result)) { 
        if (
    $table_init) { 
          
    $table_init false
          
    /* check if the heading is in our allowed_order array. If it is, hyperlink it so that we can order by this column */ 
          
    echo "<tr>\n"
          foreach (
    $row as $heading => $column) { 
            echo 
    "<td>"
            if (
    in_array ($heading$allowed_order)) { 
              echo 
    "<a href=\"{$_SERVER['PHP_SELF']}?order=$heading&cat=$cat\"><b>$heading</b></a>"
            } else { 
              echo 
    $heading
            } 
            echo 
    "</td>\n"
          } 
          echo 
    "<td>Del?</td>"
          echo 
    "</tr>\n"
        } else { 
          echo 
    "<tr>\n"
          foreach (
    $row as $heading => $column) { 
            echo 
    "<td>$column</td>\n"
          } 
          echo 
    "<a href=\"{$_SERVER['PHP_SELF']}?del=" $row['MemberID'] . "&order=$heading&cat=$cat\">Delete</a>"
          echo 
    "</tr>\n"
        } 
      } 
      echo 
    "</table>\n"

    ?>

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
  •