When this is ran an error is produced:

ERROR: Unable to execute query

INSERT INTO pm SET
subject='Invitation from (user)',
body='

Any ideas?

Let me add, it does add the person to your pending friends list but the screen that comes up after you hit "send invite" is the one with the error: Unable to execute query.