Show me your SQL table structure please.
I see the issue looks to be in the actual UPDATE record...
$updateSQL = sprintf("UPDATE users SET FirstName=%s, LastName=%s, userLevel=%s, WHERE VisitorID=%s",
That's the only place you see 'WHERE VisitorID=NULL'