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? Link to comment https://forums.phpfreaks.com/topic/230857-query-not-working/ 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? Link to comment https://forums.phpfreaks.com/topic/230857-query-not-working/#findComment-1188392 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') Link to comment https://forums.phpfreaks.com/topic/230857-query-not-working/#findComment-1188394 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. Link to comment https://forums.phpfreaks.com/topic/230857-query-not-working/#findComment-1188397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.