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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:45:55+00:00 2026-06-06T08:45:55+00:00

I am creating a personnel recruitment website and am having an issue with adding

  • 0

I am creating a personnel recruitment website and am having an issue with adding new data to a record created on the previous page.

For ease of use, I have split the form into a number of steps (each step being on a new page), where Step 1 creates the record in the candidate database table and inserts the candidate’s personal details (name, surname, contact details, gender, etc.) and sends the user to the next page (Step 2), where an profile pic can be uploaded and the path to the image is inserted into a field in the newly created record.

The problem comes in that I can’t seem to get the code to call the record ID of the relevant record. I thought of using mysql_insert_id but the issue with that is twofold. Firstly, I’m not sure if I know how to use this correctly and multiple Google searches on this have left me none the wiser. Secondly, as the company will have multiple branches around the country, there is a likelihood that two users could be adding candidates at the same time and User A could end up adding the photo to the record that User B created.

I have tried using $_POST to get the record ID but the data doesn’t seem to be passing the data to the next page once it has been inserted into the table.

I am not exactly new to PHP but this is not something I have done before because I used to have a friend who would handle this kind of thing but he, unfortunately, passed away a few months ago so I am having to learn how to do this as I go along, with little success.

I hope I am being clear enough about my problem because I am at a bit of a loss.

Any assistance would be greatly appreciated.

  • 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-06T08:45:58+00:00Added an answer on June 6, 2026 at 8:45 am

    First of all, I would use PDO (or mysqli) insetead of the deprecated mysql_* extensions.

    Using PDO, after you execute your statement, you can use two functions to get the ID you need:

    $stmt->execute($values);     // $stmt contains the prepared statement
    
    $return_code = $stmt->rowCount();
    // $return_code = 1 : new record
    // $return_code = 2 : updated record
    
    if ($return_code == 1)
    {
        $ID_YOU_NEED = $db->lastInsertId();    // $db is the database connection
    }
    

    By the way, I use rowCount() because I normally use ON DUPLICATE KEY UPDATE on most of my insert queries, you could possibly skip that step.

    Then I would store the ID in a session or add it as a hidden field for the next form.

    By the way, depending on the requirements, I would not store anything in a db just yet until all required information has come in.

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

Sidebar

Related Questions

I'm creating a website as a small store for personal use, my main question
I'm a new developer creating a simple dictionary app for personal use and my
In creating my personal website, I'm looking to incorporate many of the amazing new
I am creating a portfolio page for m personal site. I have a slider
I am creating a portfolio page for m personal site. I have a slider
I am interested in creating a website entirely in silverlight (personal reasons) but I
I'm in the proccess of creating my own web profilo and personal website. I
Creating a class at runtime is done as follows: klass = Class.new superclass, &block
I am creating a small rails app for personal use and would like to
Hi guys needing a bit of help. I am creating a one page personal

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.