Prova questo
Codice PHP:
<?php
//La sorgente dati
$destinatari = explode("|", $RecMsg["IDUtenteReciver"]);
//Preparazione e interrogazione al DB
$where = ' WHERE 0';
foreach ($destinatari as $destinatario)
$where .= " or IDUtente='$destinatario'";
$sql = "SELECT Nome, Cognome FROM register".$where;
$QueryReg = mysql_query($sql) or die("OOOPPS!!
$sql");
echo "Se la query ti sembra giusta ma il risultato finale errato, copiala e provala in PhpMyAdmin. Magari manca proprio un elemento nel DB!
$sql";
//Elaborazione del risultato
$utenti="";
while ($RecReg = mysql_fetch_array($QueryReg))
$utenti .= ", {$RecReg['Nome']} {$RecReg['Cognome']}";
if(!empty($utenti))
$utenti = substr ($utenti, 2);
//Il tanto sospirato output
echo $utenti;
?>