Well I figured out what the problem in my case was.
Any time I would delete a ticket, it would generate a few error emails as seen below.
ISSUE
Subject: DB Error
----Message Body Start----
- You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax
to use near '' at line 1
----Message Body End----
CAUSE:
I DO NOT believe this was a core coding issue.
In my case this was an issue with the email and the addresses that were being used.
Old Email Address Setup
No Reply Email Address: Support@yourdomain.com
Alert(s) FROM Email Address: Support@yourdomain.com
System Admin Email Address: Support@yourdomain.com
Email Tab Primary Email: Support@yourdomain.com
Department Manager: Support@yourdomain.com
The configuration above will never work correctly becasue it is like creating a loop, especially when piping or pop3 retrieval is in play it becomes a disaster lol.
FIX
Any way to correct I setup the following.
No Reply Email Address: NoReply@yourdomain.com
Alert(s) FROM Email Address: Alerts@yourdomain.com
System Admin Email Address: Adminitrator@yourdomain.com
Email Tab Primary Email: Support@yourdomain.com
Department Manager: Noreply@yourdomian.com
I think it actually came stock with the right emails in there I just changed them while doing testing etc... so I could do everything through one email during the testing phases.
You don't have to specify real email addresses in the alert mail fields as they run through a php_mail script.
I am not 100% that this corrected the actual DB error itself but it did stop the generation and mailing of DB errors at one point while I was running it with my test configuration in the email alert fields it was generating almost 2000 emails as it would pipe them through into OSticket and then the alert would get sent to the support@email and then an auto reply back to the same address then another DB error when I would try to delete and repeat and it would double each time I would delete them out of OSticket so 2 then 4 then 8 then 16 and so on.
I will post back to confirm wether or not the DB errors are still existant.
Any way hope this helps. Also sorry for the long reply, wanted to be clear for others.