Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Show content based on permission
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markshall" data-source="post: 397618" data-attributes="member: 1872"><p>It'll come out as a string, so you need to convert it to an integer.</p><p></p><p>If it's wrong, bear in mind that I've not coded PHP in about 8 months now.</p><p></p><p>[PHP]</p><p>$result = $conn->query("SELECT `permission` FROM `users` WHERE `username` = 'Berkay'");</p><p>if ($result->num_rows > 0) {</p><p> $user_info = $result->fetch_array();</p><p>} else {</p><p> echo 'Error finding user';</p><p>}</p><p></p><p>if (isset($user_info['permission']) && ((int) $user_info['permission']) >= 1) {</p><p> echo '<li class="parent"><a href="usermanagement.php"><i class="fa fa-users" aria-hidden="true"></i> User Management</a></li>';</p><p>}</p><p>[/PHP]</p></blockquote><p></p>
[QUOTE="Markshall, post: 397618, member: 1872"] It'll come out as a string, so you need to convert it to an integer. If it's wrong, bear in mind that I've not coded PHP in about 8 months now. [PHP] $result = $conn->query("SELECT `permission` FROM `users` WHERE `username` = 'Berkay'"); if ($result->num_rows > 0) { $user_info = $result->fetch_array(); } else { echo 'Error finding user'; } if (isset($user_info['permission']) && ((int) $user_info['permission']) >= 1) { echo '<li class="parent"><a href="usermanagement.php"><i class="fa fa-users" aria-hidden="true"></i> User Management</a></li>'; } [/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Show content based on permission
Top