Jump to content

How To Delete I All Row In Database Whan I Close Window


xmen33

Recommended Posts

hii had a chati went to code to make thiswhan i close the window of chatdelete some row in databasei make code but it dont work with Safari !code (file mahmoud.php)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   <html xmlns="http://www.w3.org/1999/xhtml">      <head>   <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />   <title>Untitled 1</title>   <script type="text/javascript">   function logout(){	   xmlHttp=GetXmlHttpObject()	   var url="mahmoud.php?"	   url=url+"logout=logout"	   xmlHttp.open("GET",url,true)	   xmlHttp.send(null)   }   function GetXmlHttpObject()   {   var xmlHttp=null;   try	 {	 // Firefox, Opera 8.0+, Safari	 xmlHttp=new XMLHttpRequest();	 }   catch (e)	 {	 // Internet Explorer	 try	   {	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   }	 catch (e)	   {	   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");	   }	 }   return xmlHttp;   }   </script>    </head>      <body onunload="java script:logout()">   <?php   $connect_m_chat=mysql_connect("localhost","root","root");   mysql_select_db('my_chat',$connect_m_chat);      if($_GET['logout']=='logout'){   mysql_query("DELETE FROM mahmoud_messages WHERE MessageID>1");   }      ?>   </body>      </html>

and all other browser work very goodso what is the problem or can any one game me other code?thanks

Link to comment
Share on other sites

Have the PHP script write out some debug information to a log or something, to make sure that it's actually getting executed. Closing the window might cancel the request in Safari or something. Use the PHP script to debug that.

Link to comment
Share on other sites

My interpretation of JustSomeGuys's response is that maybe Safari is excuting the code, But closes before the code can be completed for one reason or another. Where's the other broswers may be waiting untill the code is completed. so using the php debug functions will show you whats happening when closing the window.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...