rascle Posted March 2, 2009 Share Posted March 2, 2009 Hi basically when the user requests to log off i want this to send a note to the db saying what time you have logged off but nothing appears in the db. Please help! Code: <?php include "banner.php"; include "config.php"; echo "<center>"; if(isset($_GET['logout'])) { $times = date("i"); $timeh = date("H"); $time = floor($times); $time = "$timeh:$times"; $logtime = $time; $logdate = date("d/m/y"); echo $logged[username]; $logmeout = mysql_query("UPDATE thebusinesstycoon SET logouttime = '$logtime' WHERE '$logged[username]' = 'username'")or die(mysql_error()); $logmeout2 = mysql_query("UPDATE thebusinesstycoon SET logoutdate ='$logdate' WHERE '$logged[username]' = 'username'")or die(mysql_error()); unset($_SESSION['id']); unset($_SESSION['password']); echo '<img src="http://www.rasclerhys.com/thebusinesstycoon/logout.gif">You have been successfully Logged Out. Click <a href="http://www.rasclerhys.com/thebusinesstycoon/">Here</a>to return to the homepage.'; } echo "</center>"; include"footer.php"; ?> </body> </html> Please note the db is connected properly and that is done in config.php but i have tried it and the db does connect just not for the one i want it to lol. Thanks -RascleRhys.com Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/ Share on other sites More sharing options...
Philip Posted March 2, 2009 Share Posted March 2, 2009 '$logged[username]' = 'username' should be `username` = '$logged[username]' column names are always surrounded by backticks (`) and values by single quotes (') Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774834 Share on other sites More sharing options...
premiso Posted March 2, 2009 Share Posted March 2, 2009 That query makes no sense at all. "UPDATE thebusinesstycoon SET logoutdate ='$logdate' WHERE username = '{$logged['username']}' " Try that instead. Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774835 Share on other sites More sharing options...
rascle Posted March 2, 2009 Author Share Posted March 2, 2009 Thanks King Philip And too premisco why does it not make sense, i did it my way and it worked perfectly just like all the other times it has ?! Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774842 Share on other sites More sharing options...
premiso Posted March 2, 2009 Share Posted March 2, 2009 Thanks King Philip And too premisco why does it not make sense, i did it my way and it worked perfectly just like all the other times it has ?! Well why are you using the user's name as a field in your table....that really makes no sense to me, instead of just having a field called username and storing it there. Anyhow, if KingPhilip's worked, then yea that is how your table is designed. Weird, but I guess it works for you. Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774846 Share on other sites More sharing options...
Philip Posted March 2, 2009 Share Posted March 2, 2009 Thanks King Philip And too premisco why does it not make sense, i did it my way and it worked perfectly just like all the other times it has ?! Well why are you using the user's name as a field in your table....that really makes no sense to me, instead of just having a field called username and storing it there. Anyhow, if KingPhilip's worked, then yea that is how your table is designed. Weird, but I guess it works for you. His table setup is fine, he was just doing: value = column instead of column = value like we are used to seeing Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774851 Share on other sites More sharing options...
premiso Posted March 2, 2009 Share Posted March 2, 2009 His table setup is fine, he was just doing: value = column instead of column = value like we are used to seeing Weird, I never knew you could do it that way.....that is just bizarre! Thanks for clearing that up for me. Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774858 Share on other sites More sharing options...
rascle Posted March 2, 2009 Author Share Posted March 2, 2009 Lol Quote Link to comment https://forums.phpfreaks.com/topic/147594-solved-help/#findComment-774860 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.