You have an error in your SQL syntax near 'AND '/emmett-id-timewarner.html' LIKE CONCAT(dynamic_pages.beginurl,'%') AND '/e' at line 1