mio dio che codice contorto O.O XD

Codice PHP:
<?     
if (isset($testo) == false || $testo == "") {         
echo 
"nessun risultato!";     
}else{         
echo 
$testo;} 
if (isset(
$testo) == false || $testo == "")     { ?>
 

attenzione: Inserire una parola da cercare.</p>
 <? }else{         
$arr_txt explode(" "$testo);         
$sql "SELECT * FROM xxxx WHERE ";         
for (
$i=0$i<count($arr_txt); $i++) {             
if (
$i 0) {$sql .= " AND "; }            
 
$sql .= "(titolo LIKE '%" $arr_txt[$i] . "%' OR xxx LIKE '%" $arr_txt[$i] . "%')"; }         
$sql .= " ORDER BY xxx_timestamp DESC";         
$query mysql_query($sql$cn);         
$quanti mysql_num_rows($query);         
if (
$quanti == 0) { ?> 


Nessun risultato!</p> 
<?}else {             
for(
$x=0$x<$quanti$x++){                 
$rs mysql_fetch_row($query);               
$xxx $rs[1];
echo 
$xxx;
}         }     } 
?>
fammi sapere se funziona meti i valori giusti al posto delle "xxx" se hai problemi ti posto il mio codice che attualmente uso.
Peace.