$id = $CI->input->post('fieldname'); $query = $CI->db->query("SELECT COUNT(*) dupe FROM $table WHERE $column = ‘$str’ AND id != '$id'");