Code:
$MigUsers="INSERT INTO MigUsers (MigUser,LDomain,MigComputer,MigDate,MigTime)VALUES('$userid','$LDomain','$wksta','$MigDate','$MigTime')
has a missing space before VALUES.
Also, you never check the error codes that are returned by DBCommand(). Put appropriate error checking in place as it woudl tell you if something goes wrong. That's why functions (and UDFs) return error codes in the first place!
Finally, I highly recommend to use
Code:
$rc=setoption('explicit','on')
$rc=setoption('novarsinstrings','on')
as the first lines of your script as this will eliminate the most common scripting errors.
Thus, amend the code with these headers, put error checking in place, test again. If you still have problems, post the revised code and I'll take a closer look at it.
_________________________
There are two types of vessels, submarines and targets.