wolvez Posted May 7, 2012 Share Posted May 7, 2012 this is not working <?php session_start(); $username = $_SESSION['username']; echo mysql_query("UPDATE members SET online='0' WHERE username='$username' AND online='1'"); session_destroy(); echo "You've been logged out. <a href='index.php'>Click here</a> to return."; ?> what im trying to do is change the online mysql data from 1 back to 0 as i want to show when a user is on and off line can anyone help Quote Link to comment https://forums.phpfreaks.com/topic/262210-logout/ Share on other sites More sharing options...
Muddy_Funster Posted May 7, 2012 Share Posted May 7, 2012 why are you echoing that query? Quote Link to comment https://forums.phpfreaks.com/topic/262210-logout/#findComment-1343741 Share on other sites More sharing options...
wolvez Posted May 7, 2012 Author Share Posted May 7, 2012 thought it might of worked and forget to delete it the echo but im now sorted it out i for to includ this <?php session_start(); mysql_connect("localhost","root",""); mysql_select_db("girlzgirlz"); $username = $_SESSION['username']; mysql_query("UPDATE members SET online='0' WHERE username='$username' AND online='1'"); session_destroy(); echo "You've been logged out. <a href='index.php'>Click here</a> to return."; ?> cudnt belive it was so simple Quote Link to comment https://forums.phpfreaks.com/topic/262210-logout/#findComment-1343745 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.