[dx] Posted October 3, 2009 Share Posted October 3, 2009 Hi,Is it possible to do mysql query on page unload? So it'll be something like online check. When page loads, it inserts "1" into some coloumn "online" in db., and when page is closed update value to "0". So there's no need to calculate ctime - 10 mins etc.Just if statement.I know to make it to insert into when load page. But this..Chears Link to comment Share on other sites More sharing options...
chibineku Posted October 3, 2009 Share Posted October 3, 2009 You can capture the onunload event in JavaScript and send an XMLHTTPRequest to a PHP file from a JS function to make the query. Check out the AJAX tutorials. Link to comment Share on other sites More sharing options...
Synook Posted October 3, 2009 Share Posted October 3, 2009 Note that the unload event is a bit / very unreliable, so you should always have the timeout as a backup. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.