You can replace the whole code block above with 1 line:
PHP Code:
$query = "UPDATE vbulletin_prefixuserfield SET fieldx=1, fieldxx=1 WHERE userid = $upuserid";
When you go through this code, you always want to set fieldx and fieldxx to the value of 1, regardless of the previous value. So there is no need to retrieve old values first. Ifi i understand you correct that is.