View Full Version : Show Status Of Members
tomyknoker
03-04-2007, 02:05 PM
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!
Demonicman
03-04-2007, 02:23 PM
if you add something like a status column in the mysql you could do something like this
<?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
ShotJustice
03-04-2007, 02:28 PM
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:
<?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.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.