Wow thank you, I can't believe I missed that... and propagated through both by copy-paste >.< Goes t oshow when youv'e been staring at it too long you don't see these things. Thanks for the tip on debug mode, I am new to php and SQL syntax so I didn't really know if there was something like that, though it makes sense!
1 2008-03-27 01:37
Re: Trying to change user's group_id in functions.php -> Error (2 replies, posted in PunBB 1.2 modifications, plugins and integrations)
2 2008-03-26 23:12
Topic: Trying to change user's group_id in functions.php -> Error (2 replies, posted in PunBB 1.2 modifications, plugins and integrations)
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.