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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:13:04+00:00 2026-06-01T20:13:04+00:00

I have an ajax call to a php script that goes into a database

  • 0

I have an ajax call to a php script that goes into a database and updates a row of information. If I type the link into the browser with the supplied information I want to change then it works fine without an issue. I have SEVERAL ajax calls set up the same way as this one and they all work without a problem. Can’t figure out why this ajax call to the php script is failing to do anything.

javascript call:

function updateInfo(userID, email, username, password){
    var validGT;
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4){
            if (xmlHttp.status == 200){
                validGT = xmlHttp.responseText;
                    if(validGT == "Success!"){
                        var error = document.getElementById("update-error-message");
                        error.innerHTML = "Updated!";
                    }else{
                        var error = document.getElementById("update-error-message");
                        error.style.color = "Red";
                        error.innerHTML = "error occured";
                    }
            }
        }
    }
    xmlHttp.open("GET", "updateInfo.php?userID=" + userID + "&email=" + email + "&gamertag=" + gamertag + "&password=" + password, true);
    xmlHttp.send();
}

php script:

****connect to database and such****
$userID = $_GET{"userID"};
$email = $_GET{"email"};
$username = $_GET{"username"};
$password = $_GET{"password"};

if($password != "null"){
    mysql_query("UPDATE users SET email='$email', username='$username', password='$password' WHERE uid='$userID'") or die(mysql_error());
    echo "Success!";
}else{
    mysql_query("UPDATE users SET email='$email' AND username='$username' WHERE uid='$userID'") or die(mysql_error());
    echo "Success!";
}

mysql_close($con);

I get a response back from the ajax call saying “Success!” however it doesn’t actually do anything to the information in the database. I used firebug to make sure the information was being passed correctly and it is. So I am at loss here. What is up? Anyone have an idea?

  • 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-01T20:13:05+00:00Added an answer on June 1, 2026 at 8:13 pm

    this looks weird try

    $userID = $_GET["userID"];
    $email = $_GET["email"];
    $username = $_GET["username"];
    $password = $_GET["password"];
    

    If that does not help, try to debug/echo the query to see whats happening

    also change

    mysql_query("UPDATE users SET email='$email' AND username='$username' WHERE uid='$userID'") or die(mysql_error());
    

    to

    mysql_query("UPDATE users SET email='$email', username='$username' WHERE uid='$userID'") or die(mysql_error());
    

    but since you’ve never gotten any sql error, password seems to be “null” all the time

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

Sidebar

Related Questions

I have a ajax call to a php script that updates my MySQL DB
I have a php script that gets called via an ajax call. Values are
I have an ajax call to a php file that encodes the array into
I have a php script that is being called by an ajax post. I
I have made a generic PHP script to use for an AJAX call. I
I have an ajax request that requests a php script that connects to my
I have a script that calls a php page via jquery/ajax. The results would
I have an ajax call to one php script via jquery but it takes
I have a php script that is waiting for ajax calls at www.mydomain.com/file.php The
I have an ajax call that fires multiple times but is called once. function

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.