Jump to content

How can I update record in database for a specific tab of page loading?


Recommended Posts

How can I update record in database for a specific tab of page loading?

It's addform.php. there is a form to upload image through ajax into tmp_images table. this table has id,user_id,imagepath,post_id. post_id is irrelevant here. Everytime it inserts data with post_id=-1.

What I tried at top of addform.php:

    $user_id = $_SESSION['id'];
    $dbh = getDbconn();
    $stmt=$dbh->prepare("update tmp_images set mark=0 where user_id=:user_id and post_id=-1");

this updates all records for that user when the page loads/reloads/refreshes, problem is: if there are multiple 'addform.php' openned and multiple images have been uploaded by same user in different tabs, then if I refresh one tab it updates all records uploaded in different tabs too.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.