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 'on-the-first-line-in-puerto-pollensa-for-large-project and session_id = "0du6...' at line 1: SELECT * FROM reservas WHERE propiedad_fk = town-house-on-the-first-line-in-puerto-pollensa-for-large-project and session_id = "0du6sbi9ofeerrva5hg95fidi0"