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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:18:24+00:00 2026-06-03T06:18:24+00:00

When wanting to update field completed_status by one when this form is submitted, it

  • 0

When wanting to update field completed_status by one when this form is submitted, it is staying at 0. The query $submission is the update for the users tables.
This is the code I have been using:

$user_id = intval($_SESSION['user_id']);
if (isset($_POST['doPersonal'])) {

    if (empty($err)) {

        $Sex = mysql_real_escape_string($_POST['Sex']);
        $Second_Nationality = mysql_real_escape_string($_POST['Second_Nationality']);
        $Birth_Place = mysql_real_escape_string($_POST['Birth_Place']);
        $Birth_Country = mysql_real_escape_string($_POST['Birth_Country']);
        $children = mysql_real_escape_string($_POST['children']);

        $the_query =   "INSERT INTO personal (user_id, Sex, Second_Nationality, 
Birth_Place, Birth_Country, children)
VALUES ('$user_id', '$Sex', '$Second_Nationality','$Birth_Place', '$Birth_Country',
'$children')
ON DUPLICATE KEY UPDATE Sex=VALUES(Sex), Second_Nationality=VALUES(Second_Nationality),
Birth_Place=VALUES(Birth_Place) , children=VALUES(children)";



        // query is ok?
        if (mysql_query($the_query, $link) ){

            // redirect to user profile
            header('Location: myaccount.php?id=' . $user_id);

            $submission= "update users set completed_status=completed_status+1 where 
id='$_SESSION[user_id]'";
        }
    }
}

}

  • 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-03T06:18:25+00:00Added an answer on June 3, 2026 at 6:18 am

    From the above code we can see that you are redirecting the page before the update query so please modify it as,

    if (mysql_query($the_query, $link) ){
    
               $submission= "update users set completed_status=completed_status+1 where 
    id='$_SESSION[user_id]'";
    
               mysql_query($submission,$link);  // to execute the update query              
    
              // redirect to user profile
              header('Location: myaccount.php?id=' . $user_id);
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure how to explain this one. I submitted an update of one
I'm wanting to update a record in my database which has two values, one
I have a form which is submitted remotely when the various elements change. On
I'm wanting to grab the 10 most ordered products. My tables look similar to
I am wanting to update a css attribute using jQuery but it isnt working.
I'm wanting to do a simple edit form for our Issue Tracking app. For
I have a client that I'm wanting to move to a virtual private server.
I'm implementing a form based on Ryan Bate's [always excellent] Railscast, #52, Update Through
I use date_default_timezone_set($_SESSION['time_zone']); to set a users timezone on a page, I am wanting
I have created Facebook Test Users using the API. Facebook doesn't allow updates to

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.