Jump to content

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


colap

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");
    $stmt->bindParam(':user_id',$user_id);
    $stmt->execute();

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.