Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8681297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:28:16+00:00 2026-06-12T21:28:16+00:00

The last block of code is my issue. I want a user to be

  • 0

The last block of code is my issue. I want a user to be able to see a different style of link depending on what page they’re on. The link would be an if else statement from the SQL table itself. Now the biggest issue is the fact that I’m already using an echo variable to pull the link so I’m not sure how to reinitiate an if else inside of the SQL table itself.

<?php   
    $result=mysql_query("SELECT * FROM navigation WHERE enabled='1');
            while ($row=
            mysql_fetch_array($result))
                {

                echo $row['link'];

                }
?>

What I would like to display is something along the lines of

<?php   
    $result=mysql_query("SELECT * FROM navigation WHERE enabled='1' AND permissions >'1'");
            while ($row=
            mysql_fetch_array($result))
                {

                echo $row['link'];

                }

My Variable for Enabled is 1, so that if the variable is set to 0 the page is then disabled. After this it searches for your user permissions using

if ($admin != null)//Is Guest
if ($admin->get_permissions()==3)//Is Admin
elseif ($admin->get_permissions()==2)//Is VIP User
elseif ($admin->get_permissions()==1)//Is Registered User

I want the link to only appear to a user based off of it’s registration status, but my biggest problem lies here. I want my user to see the navigation in a certain manner depending on what page they are, but the SQL table is already being queried and is imported as a variable already, so how would I have it display along the lines of

<?php
if (stripos($_SERVER['REQUEST_URI'], 'index.php')){
     echo '<p><a href="index.php" class="active">Home</a></p>';
}
else{
     echo '<p><a href="index.php">Index</a></p>';//<-Note the removed class index in this link
}

Sorry if it’s hard to understand what I’m saying; tried to word it to the best of my ability.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:28:18+00:00Added an answer on June 12, 2026 at 9:28 pm

    Have you tried NOT combining the query and doing something along the lines of:

    <?php
        $result=mysql_query("SELECT * FROM navigation WHERE enabled='1'");
        if ($result){
            while ($row=mysql_fetch_array($result)) {
                switch($row['permission']){
                    //obv not real html tags!!!
                    case 1: echo "<reg>".$row['link']."</reg>"; break; 
                    case 2: echo "<vip>".$row['link']."</vip>"; break; 
                    case 3: echo "<admin>".$row['link']."</admin>"; break;
                    default: echo "<blank>no link</blank>"; break;
                }
            }
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

* UPDATE : See final answer code in the last code block below. *
I don't understand why is the last code block generating 1819043176 1870078063 6581362 0
Two main problems with this. One the very last code block all the way
I'm using the last version of Smarty, I'm tring to register a block but
Last evening I did some housekeeping on our code repository - basically moved the
The offending block of code is below. The code almost always works, but sometimes
The below code is designed to take a byte[] and several other things (see
I need to redirect a page when an image slider reaches the last image
I've spent the last couple days attempting to address this issue. I've performed exhaustive
I face an issue where my app requires the users location when they receive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.