SELECT tbl_mobileoverig.* FROM tbl_mobileoverig WHERE tbl_mobileoverig.hoofdthema = 'Foto's Griekenland' and tbl_mobileoverig.parameter5 <> 'fotowedstrijd-september-2003-16' and tbl_mobileoverig.fotoklein <> '' ORDER BY rand()

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 's Griekenland' and tbl_mobileoverig.parameter5 <> 'fotowedstrijd-september-2003-' at line 1