jordz Posted March 25, 2010 Share Posted March 25, 2010 Hey All, I have a page on my website that takes the first item of the mysql table and sets the screen_id to 1. //get the first currently in queue $getfirst = "SELECT * FROM photos WHERE photo_id = '$screenphoto['photo_id']' ORDER BY photo_id DESC LIMIT 0,1"; $querygetfirst = mysql_query($getfirst); $screenphoto = mysql_fetch_array($querygetfirst, MYSQL_ASSOC); //change status $progressset = "UPDATE photos SET screen_id=1 WHERE photo_id =". $screenphoto['photo_id']; $inprogress = mysql_query($progressset); However, what I want is to happen is that when the X button is hit to close the browsing window the screen_id be turned back to 0? If the X button is clicked is there a way to run a part of the script before it closes? or even a java dialogue box that once okay is clicked is redirected to a new page?. Thanks Jordan Quote Link to comment Share on other sites More sharing options...
ignace Posted March 25, 2010 Share Posted March 25, 2010 window.onbeforeunload = updateRecord_onWindowClose; // OR window.onunload = updateRecord_onWindowClose; Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 25, 2010 Share Posted March 25, 2010 1. JavaScript != Java 2. There is no reliable way of detecting that a browser has been closed, so do not rely on these examples. Quote Link to comment Share on other sites More sharing options...
ignace Posted March 25, 2010 Share Posted March 25, 2010 2. There is no reliable way of detecting that a browser has been closed, so do not rely on these examples. Not to mention the annoyance it creates if it does do work. 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.