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 8592353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:43:56+00:00 2026-06-11T23:43:56+00:00

I have a table of users. Each user has an enabled flag that is

  • 0

I have a table of users. Each user has an enabled flag that is either 1 or 0.

Say I want to have a select box with all enabled users, that’s easy enough to do. My trouble comes down the road when a user is editing a form and it pulls up the currently enabled users, but the currently selected user is not an enabled user.

Normally my query would be something like

SELECT first_name, last_name from users WHERE enabled = 1

However, if this is an edit form, and the currently selected user isn’t enabled anymore and the user submits the form, I will lose the currently selected user.

What would be the best way to handle this? The only way I can think to do it is to create a join in the query that also gets the currently enabled user but I’m wondering if there is a better way. Mainly because some of our forms have this user field in 5 or 6 places on a page and I would have to have to make 5 or 6 different queries just so that I could get the current user.

  • 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-11T23:43:58+00:00Added an answer on June 11, 2026 at 11:43 pm

    I think I finally understand the problem. The easiest way I could approach this is by loading ALL users but only filter them when you’re building the drop-down.

    The drop-down condition would become something like:

    if ($user['enabled'] || $user['id'] == $lead['admin']) { ... }
    

    You can do the same thing with a JOIN condition in SQL, but that would require more work if multiple roles are present on the form.

    Whether or not loading ALL users is a problem, I can’t tell 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of users and each user has another user that they
I already have a table in phpmyadmin that contains users records. Each user has
I have a table users with primary index userId . Currently, each user has
I have about 1 million data in users table. Now I want each user
I have a table named users and each row (user) has an image. The
I have a USERS table. Each user has connections in a CONNECTIONS table. Each
I have a users table, and each user has a unique user_id . Each
I have a mysql table with my users... each user has various attributes like
I have a table for users. Each user has certain skills they teach. So
Scenario: We have 5 users. (users table) Each user has up to 10 imgs.

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.