select * from members, categories where members.id = and members.category_id = categories.categoryId 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 members.category_id = categories.categoryId' at line 1