hard to tell what exactly the problem is.... but no doubt sounds related to an sql query.

i'm not sure if you are saying the problem is here:

/YOUR_ADMIN/index.php
or...