zkuste toto
$query='SELECT DISTINCT publication_id FROM publications WHERE 1=1 ';
if(isset($keyword_label) && isset($publication_year)){
$query.=' AND (publication_key_1="'.$keyword_label.'" OR publication_key_2="'.$keyword_label.'" OR publication_key_3="'.$keyword_label.'" OR
publication_key_4="'.$keyword_label.'" OR publication_key_5="'.$keyword_label.'" OR publication_key_6="'.$keyword_label.'" OR
publication_key_7="'.$keyword_label.'") AND publication_year="'.$publication_year.'"';
}
if(isset($publication_year)){
$query.=' AND publication_year="'.$publication_year.'"';
}
if(isset($keyword_label)){
$query.=' AND publication_key_1="'.$keyword_label.'" OR publication_key_2="'.$keyword_label.'" OR publication_key_3="'.$keyword_label.'" OR
publication_key_4="'.$keyword_label.'" OR publication_key_5="'.$keyword_label.'" OR publication_key_6="'.$keyword_label.'" OR
publication_key_7="'.$keyword_label.'"';
}
$query.=' ORDER BY publication_year DESC';
EDIT:
zkuste to změnit
if(!$result) {
k tomuto
if( $result == false ) {