Query SELECT u.`username` FROM `users` u INNER JOIN `users_properties` up ON u.`sid`=up.`object_sid` WHERE up.`id`='companyName' AND up.`value`='SiS mediadors d'assegurances' : 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 'assegurances'' at line 1