betportal Posted June 17, 2010 Share Posted June 17, 2010 Hey guys, What I want: I would like to change a text as regard the level of access of the visitor. The visitors have level 0, member level 1. Thus, if the person is a visitor (level 0) he will see "to view the content please register", otherwise, if the person is already a member (level 2) he will see the content "Today's joke is....". I am very noob in php and I've started coding something (my website in under Nuked-Klan) just to try to figure out if the code is working and I still have errors. How can I make this kind of code? I know it's basic but I am too noob Thank you <?php global $user //opentable(); if ( $user[1] == 0 ) { echo "NO MEMBER DETECTED 0"; } if ( $user[1] == 1 ) { echo "MEMBER DETECTED 1"; } if ( $user[1] == 9 ) { echo "ADMIN DETECTED 9" } //closetable(); ?> Link to comment https://forums.phpfreaks.com/topic/205067-problem-with-echo-and-if-statements/ Share on other sites More sharing options...
syed Posted June 17, 2010 Share Posted June 17, 2010 What do you want us to check? or help with Link to comment https://forums.phpfreaks.com/topic/205067-problem-with-echo-and-if-statements/#findComment-1073497 Share on other sites More sharing options...
betportal Posted June 17, 2010 Author Share Posted June 17, 2010 I would like a code for this : "I would like to change a text as regard the level of access of the visitor . The visitors have level 0, member level 1. Thus, if the person is a visitor (level 0) he will see "to view the content please register", otherwise, if the person is already a member (level 2) he will see the content "Today's joke is...."." Link to comment https://forums.phpfreaks.com/topic/205067-problem-with-echo-and-if-statements/#findComment-1073499 Share on other sites More sharing options...
TOA Posted June 17, 2010 Share Posted June 17, 2010 I would like a code for this : "I would like to change a text as regard the level of access of the visitor . The visitors have level 0, member level 1. Thus, if the person is a visitor (level 0) he will see "to view the content please register", otherwise, if the person is already a member (level 2) he will see the content "Today's joke is...."." I once used this statement to let a user "feature" themselves or remove themselves from the list: $feat_res = mysql_query("SELECT DISTINCT User FROM UserTable WHERE User='$_SESSION[user]' AND Featured=1", $connection); if (mysql_num_rows($feat_res) == 1 ) { $_SESSION['Featured'] = true; echo '<a href="featureMe.php">Unfeature Me</a><br />'."\r\n"; } else { $_SESSION['Featured'] = false; echo '<a href="featureMe.php">Feature Me!</a><br />'."\r\n"; } Might that be what your looking for? Just test for your condition and execute different scenarios Link to comment https://forums.phpfreaks.com/topic/205067-problem-with-echo-and-if-statements/#findComment-1073501 Share on other sites More sharing options...
betportal Posted June 17, 2010 Author Share Posted June 17, 2010 Hi thank you ! My database is called "datab1" -> "nuked_users" -> "level" How can I transform it into your statements? Link to comment https://forums.phpfreaks.com/topic/205067-problem-with-echo-and-if-statements/#findComment-1073537 Share on other sites More sharing options...
TOA Posted June 17, 2010 Share Posted June 17, 2010 Hi thank you ! My database is called "datab1" -> "nuked_users" -> "level" How can I transform it into your statements? I'm not going to do it for you Google php mysql functions If you can't find what you need come back and we'll go from there Link to comment https://forums.phpfreaks.com/topic/205067-problem-with-echo-and-if-statements/#findComment-1073668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.