Simon180 Posted September 11, 2007 Share Posted September 11, 2007 can sumone help me please I am trying to pull up a basic account level status using array to hold the rank of the user the way it works is when user joins the site he is issused his basic newbe membership rank 0 I would like a way of checking the database to see if that user has been updated to rank 1/2 so on and if so for the script to select the right array for that persons level am not good at the coding game so alot of help will be needed thanks alot peeps here the code $ranks = array( 0=>"Newbe", 1=>"Basic", 2=>"Super", 3=>"Admin"); // User Account Level Check $user_current_level = $row["userlevel"]; // database table name is [ userlevel ] $query = mysql_query("SELECT username FROM accounts WHERE userlevel = '$user_current_level'") // want it to check the database for the current userlevel and then show it in text from the array what level that person is.. or die(mysql_error()); $row = mysql_num_rows($query); if ($user_current_level < 3){ $user_current_Rank = "ADMIN";} else{ $user_current_Rank = @$ranks[$user_current_level]; // get other level } hope sumone can help me cheers Quote Link to comment https://forums.phpfreaks.com/topic/68873-account-level-array-problems-help-needed/ Share on other sites More sharing options...
gerkintrigg Posted September 11, 2007 Share Posted September 11, 2007 start with a select query to determine the rank: $q="SELECT * FROM member WHERE id='whatever' ;"; $sql=mysql_query($q); $r=mysql_fetch_array($sql); $rank=$r['rank']; Then do a switch statement on the rank: switch($rank){ case '0': // mysql code to update the rank goes here(?) break; case '1': echo 'User rank 1... do whatever you should for user rank 1'; break; case '2': echo 'User rank 2...'; } Quote Link to comment https://forums.phpfreaks.com/topic/68873-account-level-array-problems-help-needed/#findComment-346145 Share on other sites More sharing options...
Simon180 Posted September 11, 2007 Author Share Posted September 11, 2007 can you be abit more clear please newbe here sorry Quote Link to comment https://forums.phpfreaks.com/topic/68873-account-level-array-problems-help-needed/#findComment-346153 Share on other sites More sharing options...
Simon180 Posted September 11, 2007 Author Share Posted September 11, 2007 ok can sumone else help me??? am trying to get current rank from database then to show it on my emails but am having trouble getting info, I want it to use the rank array to get the current rank title from database anyone????? Quote Link to comment https://forums.phpfreaks.com/topic/68873-account-level-array-problems-help-needed/#findComment-346218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.