Thursday 15 September 2011

php function call via ajax issue -


I have a home.php through which I send some data which is inserted in DB, which by calling an AJAX call On any other PHP page, the function is called. Php is generated against a unique ID entry and is stored in a $$ INV.

When the user leaves home.php page, I want to delete the special entry that was inserted in DB, by making another AJAX call to the same function. Php, but the problem is that the previously generated $ id has been reloaded to function.php.

With no idea how I can store IDs, so when I need it, I can get it back.

Some codes would be great.

Above

Try this way:

Place it on your pages to start a session: session_start () . Then after entering the data in DB, $ _ session ['sql_insert_id'] = $ id - assuming you only need to enter one per visitor.

Then when you have to remove from DB, you have $ id stored in $ _ session ['sql_insert_id']

You can close the session even after deletion:

  session_unset ($ _ session ['sql_insert_id']); Session_destroy ();    

No comments:

Post a Comment