Salve a tutti.
Ho nel database una tabella Messaggi con ID, Mittente, Destinatario, DelUtente1,DelUtente2, Letto, OraInvio.
Ora però non riesco a fare una tabella con le conversazioni selezionando singoli mittenti, in modo che venga fuori una scritta se per quel mittente ci sono nuovi messaggi da leggere o meno.
Ho questo codice
Dove in DelUtente1 e DelUtente2 ci sono i nickname dei due utenti ( mittente e destinatario ) se hanno eliminato entrambi il msg.codice:<table border=0 width="500" class="Welcome"> <tr> <?php // SELEZIONO CONVERSAZIONI $MySql = "SELECT DISTINCT Mittente FROM Messaggi "; // DISTINTI MITTENTI $MySql .= "WHERE Destinatario = '$UtenteLog' AND Mittente != '$UtenteLog' "; // DESTINATARIO UtenteLog $MySql .= "AND DelUtente1 != '$UtenteLog' "; // CONV NON ELIMINATA $MySql .= "AND DelUtente2 != '$UtenteLog' "; // CONV NON ELIMINATA $MySql .= "GROUP BY Mittente ASC"; $Result = mysql_query($MySql); while ($rs = mysql_fetch_array($Result)) { ?> <td align="left">[img]/images/icon/conv.png[/img] " target="centro"><?= htmlspecialchars($rs["Mittente"]) ?> - " target="centro" alt="Messaggi da <?= htmlspecialchars($rs["Mittente"]) ?>">Apri conversazione <? if($NonLetti != "0") { ?>- NUOVI MSG<? }; ?></td> <tr><td colspan=2><hr size=2></td></tr> <? } $rs->close; ?> </table>
Non riesco proprio a trovare un modo funzionante.. vero anche che adesso $NonLetti non ha più un senso ma dopo svariati test ho riportato il codice all'origine in cerca di un'alternativa.
Avete suggerimenti? G R A Z I E