doddsey_65 Posted March 16, 2011 Share Posted March 16, 2011 I am using a query to update the db when a user logs in. It sets every value correctly but it doesnt set the colum u_online which is INT(1). $link->query("UPDATE ".TBL_PREFIX."users SET u_last_login = '".$config['time_now']."', u_online = 1, u_ip = '".$_SERVER['REMOTE_ADDR']."', u_activity_time = '".$config['time_now']."', u_points = u_points + '$login_points' WHERE u_username = '$username'") or die(print_link_error()); when i echo the query: UPDATE asf_users SET u_last_login = '1300310822', u_online = 1, u_ip = '127.0.0.1', u_activity_time = '1300310822', u_points = u_points + '1' WHERE u_username = 'doddsey65' which works because i tried it in phpmyadmin and it changed the column. But it doesnt work in the actual script. It changes every other value that its supposed to but the u_online. Anyone have any ideas why? Quote Link to comment Share on other sites More sharing options...
btherl Posted March 16, 2011 Share Posted March 16, 2011 Do you have another query which sets u_online to 0? In what circumstances is that other query executed? Quote Link to comment Share on other sites More sharing options...
doddsey_65 Posted March 16, 2011 Author Share Posted March 16, 2011 Do you have another query which sets u_online to 0? In what circumstances is that other query executed? in login.php i use this to logout the user $link->query("UPDATE ".TBL_PREFIX."users SET u_last_login = '".$config['time_now']."', u_online = '0' WHERE u_username = '$username'") or die(print_link_error()); but that only runs if the get value do is present and it = logout and when they are logging in that value isnt set. if(isset($_GET['do']) && $_GET['do'] == 'logout') Quote Link to comment Share on other sites More sharing options...
btherl Posted March 16, 2011 Share Posted March 16, 2011 Ok.. well there are a two main possiblities here: 1. The query you posted is running, and another query changes u_online later 2. The query you posted is not running, and instead another query is changing the other values. Here's some of the things I would try to debug it: 1. Have the script exit immediately after running the query, and see what u_online is set to 2. Comment out the query and see if any other code updates the other columns 3. Comment out all other code which changes u_online and see if u_online is 1 after the script runs. Quote Link to comment 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.