View Full Version : Show Status Of Members

03-04-2007, 03: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!

03-04-2007, 04:49 PM
$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):

echo $member_status[$row['user_status']];
And to get a count of all users of a certain group you could:
SELECT COUNT(*) FROM `users` WHERE `user_status` = 'A'Or select all rows and have php sort them.