Ragazzi scusate il disturbo, risolto, dovevo usare UNION, ma non come facevo io...
Codice PHP:
if($codice!=""){
              
$sql "SELECT * FROM xxx WHERE codice=$codice UNION SELECT * FROM xxx2 WHERE codice=".$codice;
          }else{
              
$sql "SELECT * FROM xxx WHERE id=$id UNION SELECT * FROM xxx2 WHERE id=".$id
Grazie
Scusate il disturbo...