Forgive me, but I'm a rank newbie with databases and php (old QuickBasic guy...) so I have a couple of questions:
Would the code above take care of creating that field in the user record, or do I need to do something first to create the new field?
And when/how often would that code be executed by including it in the phpinclude template?
You'd just have to create a field called newfieldname (or use your own, just be consistent) and make the changes. Whenever a user new field and profile field aren't equal, it will update them.