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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:25:03+00:00 2026-06-13T05:25:03+00:00

change status vice versa when active then change status in db as inactive if

  • 0

change status vice versa when active then change status in db as inactive

if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = $_GET['id'];
$result = mysql_query("UPDATE profile SET status='active' WHERE status='inactive' AND id =$id")
or die(mysql_error()); 

header("Location: admin-members.php");
}
else{
header("Location: admin-members.php");
}

this is a working code but i wanted it to work both ways. when i click inactive it would change it active and vise versa. i tried it with case too but no luck

?>

  • 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-13T05:25:04+00:00Added an answer on June 13, 2026 at 5:25 am

    maybe you only want to filter it by $sid and use CASE to toggle the value of status

    UPDATE profile 
    SET status = (CASE WHEN status = 'active' THEN 'inactive' ELSE 'active' END)
    WHERE id = $id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following functions: $(input[id^='Position_']).change(function () { update('Position'); }) $(input[id^='Status_']).change(function () { update('Status');
I need to change status line message from a handler class. After reading the
I need to make entities to change status except being deleted. For those I
The MVC pattern wants that Model dispatches change status events to View. Which is
I want to change the status of my gtalk using my application. For that
i am able to update user status using the following URL https://graph.facebook.com/944254185/feed?method=post& message=hello &access_token=4E35zZCu8xtLBExPJvbGCmYOXFOGe8P
How to change status from first Template to second template when I'm login into
I have Jquery code that checks on .change status of HTML select element and
There is a page in which there are multiple rows with a 'Change Status'
I'd like to update mySql row with a number which is represents a status.

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.