array(15) { [4602]=> int(4602) [3964]=> int(3964) [4249]=> int(4249) [3965]=> int(3965) [3889]=> int(3889) [3876]=> int(3876) [4252]=> int(4252) [4814]=> int(4814) [3963]=> int(3963) [3966]=> int(3966) [3879]=> int(3879) [4819]=> int(4819) [4820]=> int(4820) [3913]=> int(3913) [3955]=> int(3955) } You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND a.id IN ( SELECT a2.id ...' at line 6