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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:26:07+00:00 2026-05-25T16:26:07+00:00

Here is the situation – I need to persist an object between pages. On

  • 0

Here is the situation –

I need to persist an object between pages. On the first page I create the object, and create a form for it. On the second page, I persist the object. The user then has an option to go back and edit their choices, or finish and post.

I would prefer not to flush my changes to the database until the user is done editing the object. The problem is that the object doesn’t get a unique ID until it is flushed to the database.

Does anyone know how I can retrieve the persisted yet unflushed object? Is this even possible? Is there a better way to do this?

  • 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-05-25T16:26:07+00:00Added an answer on May 25, 2026 at 4:26 pm

    You serialize the object until you complete all it’s properties. You can hold the serialized object in the session to persist between pages. When you are ready to update or insert just unserialize it and put it into the database.

    EDIT: example

    // page 1
    $object->setProperty($value);
    $_SESSION['object'] = serialize($object);
    
    // page 2
    $object = unserialize($_SESSION['object']);
    // use $object
    
    $_SESSION['object'] = serialize($object);
    
    
    // page N
    $object = unserialize($_SESSION['object']);
    $object->insertIntoDB();
    

    EDIT 2 – Don’t forget to include the class definition in all pages that unserialize the object or else it won’t work.

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

Sidebar

Related Questions

Here my situation : The user click on a LinkButton, and the page does
Here's the situation: we have an Oracle database we need to connect to to
I have a situation here there are two models User,Posts Now I want to
i have a situation here where i need to pass the date as sysdate
Hi I have a strange situation here: # Is there a semantic difference between
I have a situation here where I need to distribute work over to multiple
I am dealing with a puzzling situation here,and need any help I can get
I'm having a bit of a weird situation here. I have a form that
My situation here is that I need to send my program to my university's
I have a situation here i am taking input from user using scanf can

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.