Salve a tutti,
Ho una variabile $test che contiene degli id, vorrei stampare "nome-ok" se l'id è presente nel database e "nome-ko" se non è presente in esso...
Sto facendo i test per "nome-ko" ma non mi funziona, mi stampa tutti gli id nel db...
In questo esempio dovrei stampare tutti gli id, esclusi 1 e 2.
Mi date un aiutino?
Grazie

codice:
$test="1-2"
$dj = explode("-", $test);
foreach ($dj as $con) {

$query = mysql_query("SELECT id,nome FROM $db_table1 where id!= ".$con." order by nome");
//tutti gli id tranne 1 e 2


while($row = mysql_fetch_array($query)) {

echo $row['nome']."-ko
";

}
}