colap Posted September 8, 2018 Share Posted September 8, 2018 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. Quote Link to comment Share on other sites More sharing options...
requinix Posted September 8, 2018 Share Posted September 8, 2018 Sounds like post_id needs to be relevant. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.