...

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!

Inigoesdr
03-04-2007, 03:49 PM
<?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
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum