Time : 10:37:06 SQLSTATE[42000]: Syntax error or access violation: 1064 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 ')a)' at line 3 Raw SQL : select min(DATEOFEDITIONS) mins,max(DATEOFEDITIONS) maxs from magzineeditions where MAGZINEEDITIONSID in ( select magzineeditions from ( select * from suborders where ADVERTISEBOOKINGID in ('') and magzineeditions<=201 order by SUBORDERSID desc limit )a) Time : 01:10:26 SQLSTATE[08004] [1040] Too many connections Time : 01:00:07 SQLSTATE[08004] [1040] Too many connections Time : 00:30:02 SQLSTATE[08004] [1040] Too many connections