SELECT * FROM tblprofile as A,tblphotos as B WHERE A.intUserID=B.intUserID AND A.isActive='YES' AND (A.strFirstName like 'Ka'imi' AND A.strLastName like 'Kuoha') : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'imi' AND A.strLastName like 'Kuoha')' at line 1