SELECT tbl_mobileoverig.* FROM tbl_mobileoverig WHERE tbl_mobileoverig.hoofdthema = 'Foto's Griekenland' and tbl_mobileoverig.parameter5 <> 'fotowedstrijd-mei-2003-6' 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-mei-2003-6' and' at line 1