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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:10:21+00:00 2026-05-17T03:10:21+00:00

So I am going through our database and removing some unneeded access levels that

  • 0

So I am going through our database and removing some unneeded access levels that are basically duplicates of other ones. Our database structure has a column user_level which is an enum that has a bunch of different strings (I know this isn’t a great way to run user access levels but this is how the original developer made it).
What I am looking to do is to create a rollback that will save all the user_id’s with their appropriate user_level so that in a few days if we see that we are having issues with our access levels we can roll back without messing up any other changes that have occurred in the database since we ran the update command.

What I was thinking of doing was just doing a

SELECT users.id, users.user_level
FROM users
WHERE users.user_level NOT IN ('Program Administrator','Executive','Sales Manager / Office Manager/ Company President');

then just manipulating the data that way, but what I would really like is have it create a query for me so we can place it in our ticket tracking system and all we have to do is copy / paste the query into our sql tool to run it for rollback.

However I am not sure what the best approach is. We have about 58,000 user records in our database.

So my question is does anyone have any ideas of how I should proceed and possibly some examples for this custom rollback.

EDIT:

So am looking for an equivalent of this php code but for MySQL

while ($user = mysql_fetch_array($databaseObj->result)) {
    echo "UPDATE users SET user_level = '". $user['user_level'] ."' WHERE id='".$user['id']."'";
    echo "<br>";
}

which will output

UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='80006' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='48' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='42' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='47' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='49' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='52' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='58' 
UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='60'

which I can then save to a .sql file and just run this file should I need too.

  • 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-05-17T03:10:21+00:00Added an answer on May 17, 2026 at 3:10 am

    I just went the PHP approach and create a php script to query the database and output the SQL update commands to a file.

    while ($user = mysql_fetch_array($databaseObj->result)) {
        echo "UPDATE users SET user_level = '". $user['user_level'] ."' WHERE id='".$user['id']."'";
        echo "<br>";
    }
    

    which will output

    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='80006' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='48' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='42' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='47' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='49' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='52' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='58' 
    UPDATE users SET user_level = 'Sales Person/Packager' WHERE id='60'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.