advanced search categories added and SQL syntax fix