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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:06:41+00:00 2026-06-08T05:06:41+00:00

I have a script which runs when a user hits the ‘reject’ button on

  • 0

I have a script which runs when a user hits the ‘reject’ button on some terms.
When it runs it should revoke the access rights to the particular area, for some reason the script doesn’t work- as in it doesn’t update the MYSQL DB nor do I get die error.

$username =  $_SESSION["USER"]["Username"]; 

mysql_connect("x", "y", "z") or die(mysql_error()); 
mysql_select_db("database") or die(mysql_error()); 
mysql_query("UPDATE `users` SET `SeceretArea`='Unauth' WHERE `Username`='$username'") or die(mysql_error());
  • 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-08T05:06:43+00:00Added an answer on June 8, 2026 at 5:06 am

    ANSWER UPDATED TO SUM UP DEBUGGING PROCESS.

    If there is no error, then there are three possibilities as to why the database entry isn’t happening:

    • There is no entry in your table where the USERNAME column is equal to $database.
    • There is no value being passed to $database.
    • There is a value being passed to $database, but that value isn’t being replaced into the query.

    From my personal experience, mysql_query() doesn’t necessarily substitute variable values in before executing the query. Create the query string first into a variable, then pass it to mysql_query(). Your current setup doesn’t replace $username with its value. What you can do is this:

    ...
    $sql = "UPDATE `users` SET `SeceretArea`='Unauth' WHERE `Username`='$username'";
    mysql_query($sql) or die(mysql_error());
    

    Apart from that, check your table to make sure that there is a row with the value you want in USERNAME. var_dump() your $username to see if it’s the value that you intended.

    Also, you really should consider switching to either mysqli or PDO. If you don’t want to migrate to an object module, you can use mysqli‘s procedural functions.

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

Sidebar

Related Questions

I have a lotus-script agent which runs as Web User since I need to
Currently I have a bash script which runs the find command, like so: find
I have a simple Perl script which runs as a Linux daemon using an
I have a form in html which runs a php script whitch inserts text
I have an Stand alone Application which runs Shell Script(with parameters)in Ubuntu. ProcessBuilder pb1
I have a cron job to run a Ruby script, which runs fine on
I have a python script that runs a program, which generates few .exe files
i have a script which is for virtual keyboard, i am facing some problem
I'm trying to update some existing code that normally runs a Perl script which
I have a school project for a Python script which runs an SQL query

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.