kbeaulieu Posted March 11, 2010 Share Posted March 11, 2010 I am trying to get my logout.php file to work. I want it to destroy the session and update the timeout header in my database. I can't seem to get it to add the timeout to the database. Can anyone help. <?php //connect to database $con = mysql_connect ("localhost", "root", ""); //error handling if(!$con) { die('Could not connect: ' . mysql.error()); } //get things entered from user mysql_select_db("mydb", $con); session_start(); $sessid = session_id(); mysql_query("UPDATE sessions SET timeout=current_timestamp WHERE sessionid='$sessid'"); // setcookie(session_name(),",1); session_destroy(); mysql_close($con); $URL="login.html"; header('Location:' . $URL); ?> Link to comment https://forums.phpfreaks.com/topic/194944-logoutphp/ Share on other sites More sharing options...
ohdang888 Posted March 11, 2010 Share Posted March 11, 2010 make it throw an error is mysql is incorrect... in other words, change this: mysql_query("UPDATE sessions SET timeout=current_timestamp WHERE sessionid='$sessid'"); to this: mysql_query("UPDATE sessions SET timeout=current_timestamp WHERE sessionid='$sessid'") or die('Error:'.mysql_error()); Link to comment https://forums.phpfreaks.com/topic/194944-logoutphp/#findComment-1024939 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.