Topic: Trying to change user's group_id in functions.php -> Error
Long story short, I'm trying to change a user's group_id automatically based on some outside information. This is happening in functions.php (actually in a modified version of the original check_cookie function).
I am sure that the problem lies in the SQL query itself, as no errors occur when I comment the queries out. I saw a very similar query elsewhere in the code which appears to work, and I cannot understand what is wrong with mine. If anyone has an idea please let me know :-)
Here is the code (note: at this point, $pun_user, $pun_user['id'], PUN_ADMIN, and PUN_MEMBER are all well-defined--I can "echo" them and they have the desired values).
$db->query('UPDATE '.$db_prefix.'users SET group_id='.PUN_ADMIN.' WHERE id='.$pun_user['id']) or error('Unable to change from admin to regular user', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db_prefix.'users SET group_id='.PUN_MEMBER.' WHERE id='.$pun_user['id']) or error('Unable to change from admin to regular user', __FILE__, __LINE__, $db->error());
Thank you.