Basic Membership System Trouble with Normal,Expert & Super Users


#1

First Time to PHP,I have pulled my hair out for 3 days with this watching hours of Tutorials and still can’t get this basic coding done. I could use some help. Let me first say that this entire membership system was freeware from Adam Khoury and works perfect. It is me who has the problem being a Newb.The database and everything else is 100%. Users sign up as A,B or C.
What I am trying to do is take the different user types and give them each a link to a different page of content.
I also am trying to put this link next to the other links in their member account. I have 3 blank pages one for each level. normal_user.php, expert_user.php & super_user.php.
The Code Above the HTML.
[php]// Give different options or display depending on which user type it is
if ($accounttype == “a”) {
$userOptions = “You get options for Normal User”;
} else if ($accounttype == “b”) {
$userOptions = “You get options for Expert User”;
} else {
$userOptions = “You get options for Super User”;
}[/php]

In the HTML below I have tried If’,If else,else and so many other types of code and am getting nowhere.
[php]

<?php echo $toplinks; ?>

<?php echo "$username"; ?>

[/php] I am not looking for someone to do the entire coding here, but if you could just give me a line for the normal user, I should just be able to change a few things in the other 2? For the person that takes the time to help me with this, Thank You in advance. You have no idea what it is like to work on something for 3 days straight with no success >:( :( :'( :-[. Thanks again. :-*

Your Account

Edit Information

Edit Picture

<?php /*?>These links all go to the member account page and under (View Profile) is where I am trying to put the 1 of 3 links depending on user level. Normal, Expert or Super <?php */?>

" target="_self">View Profile


#2

[php]
if ($accounttype == “a”) {
$userOptions = “You get options for Normal User”;
} elseif($accounttype == “b”) {
$userOptions = “You get options for Expert User”;
} else {
$userOptions = “You get options for Super User”;
}
[/php]
elseif must be together in one word and also i have noticed one more error in your script

[php]<?php echo "$username"; ?>[/php]

when you want to output just a variable you dont need the " " anymore
[php]<?php echo $username; ?>[/php]

and here is a better way to get $accounttype:

[php]<?php $accounttype = mysql_fetch_row(mysql_query("SELECT accounttype FROM your_table where user_name or user_id=‘your_variable(username or id)’ LIMIT 1 "));
$accounttype=$accounttype[0];
?>
[/php]


#3

I am a newb, I had to double check to make sure I posted in the proper forum. Over the last 3 day’s I have watched no less than 10 hours of video tutorials. I can see now why this stuff is so difficult.
Of course I have started with all the beginners tutorials and am trying to do my best at understanding them as well as learning and taking advice from them.
That being said, 2 different tutorials have said it is good coding practice to always use “” and the semi colon as these will be helpful when/if I start to do more complex coding .
Again being a newb, the other method you suggest of getting to the $accounttype is even more confusing than what I have already.
I want to say thanks for taking the time to try and help me here, but I find this just a little to advanced for me at the moment and for now just need to stick with very basic stuff for awhile.
Thank You Again :slight_smile: