I did this and it now seems to work. But is this the right way to do it or should I change it to what you have in the post abaove?
PHP Code:
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,showimage,iconid,messageread,folderid,receipt,attachmentid) VALUES (NULL,$touserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time().",'$signature','$showimage','$iconid',0,0,$receipt,$attachmentid)");
I also moved it in the lines, but I don't think it really matters where it is at in there, does it?