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

  • SEARCH
  • Home
  • 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 8530877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:21:20+00:00 2026-06-11T09:21:20+00:00

Basically what i am trying to do here is to read from the table

  • 0

Basically what i am trying to do here is to read from the table in my database using the customers login details, then retrieve the record that matches this information. In this table there is a column called “AccountType”, this differentiates the average user from a manager, if this column is 1, they are a average user. If this column is 2, they are a manager.

Now im having issues implementing this in my code, below is the snippet of my process script for the login:

<?php

***session_start()

$query = mysql_query("SELECT * FROM accounts WHERE username='$username' and password='$password'", $db) or die ("Query failed with error: ".mysql_error());

$count=@mysql_num_rows($query);

if(***$count == 1)
    {
    ***$user_row = mysql_fetch_array($result)

        $userid = $user_row["userid"];    
        $_SESSION['userid'] = $userid;

        $customername = $user_row["customername"];    
        $_SESSION['customername'] = $customername;

        $AccountType = $user_row["accounttype"];

        if ($AccountType == 2)
        { 
            $_SESSION['manager'] = $AccountType;
        }

Depending on this, when my check login script which every page includes, it will display specific links on the navigation depending what there account type is, if they are user they will have access to normal links, but if they are a manager they have access to admin functions, below is the code snippet for this also:

***session_start();
if (***isset($_SESSION['userid'])) 
{
    $employeeid = $_SESSION['userid'];
    $firstname = $_SESSION['customername'];

    if (***isset($_SESSION['manager'])) 
    {
        $User_Options .='Manager links go here';
    }

    else
    {
    $Links .='Normal Links go here';
    }   

}

Thats just a basic truncated version, but that gives the basis of what im trying to accomplish. I am guessing down to using the while loop its overwriting the session, which i understand, however there will only be one record for the information i am searching. It works to some extent, however even if the AccountType is 1, it displays the options for 2.

Can anyone assist me further in solving this issue? Thankyou!

  • 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-11T09:21:22+00:00Added an answer on June 11, 2026 at 9:21 am

    Use something like this on the login form:

    $_SESSION['manager'] = false;
    if ($AccountType == 2) {
      $_SESSION['manager'] = true;
    }
    

    then later:

    if ($_SESSION['manager']) {
      // display manager-only options
    } else {
      // display user-only options
    }
    // Display options for everyone here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm basically trying to extract a Mac application from a zip file using QuaZip.
Basically I am trying to restart a service from a php web page. Here
I'm trying to run a query on DBPedia.org via SPARQL. Basically, here's what I
I'm trying to basically trying to separate a specific amount of text from the
Basically I want to do this: delete top( 100 ) from table order by
I am trying to fix a stored procedure that someone else wrote. Basically the
I am trying to pass an array of ints from C# to C++/CLI. Here's
I am trying to read in a file that has HTML list items with
I was trying to scrape some information from a website page by page, basically
I am trying to pull the top three rows from a database based off

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.