Salve a tutti,
Sono a proporvi un quesito che mi sta facendo diventare matto da un po di tempo.
Vi scrivo la parte di codice.
Codice PHP:
while($row = mysqli_fetch_array( $result )) {unset($conferma);$conferma = $row['conferma']; $data = date("d/m/Y", strtotime($row['online']));if ($data == "01/01/1970"){ $data = "";}if ($row['IP'] == "::1") { $IPU = "LocalHost";} else { $IPU = $row['IP']; } // emissione del contenuto di ogni riga in una tabellaecho "<tr>";echo '<td><center>' . $row['id'] . '</center></td>'; echo '<td>' . $row['user'] . '</td>';echo '<td>' . $row['nome'] . '</td>';echo '<td>' . $row['cognome'] . '</td>';echo '<td>' . $row['pass'] . '</td>';
if ($conferma <> "SI"){
echo '<td><a href="javascript:void(0)" onclick = "document.getElementById(\'light\').style.display=\'block\';document.getElementById(\'fade\').style.display=\'block\'" title="' . $row['conferma'] . '">NO</a> <div id="light" class="white_content"><p style="text-align:right"><a href = "javascript:void(0)" onclick = "document.getElementById(\'light\').style.display=\'none\';document.getElementById(\'fade\').style.display=\'none\'">Chiudi</a></p><br>Codice Attivazione:<br>' . $row['conferma'] . '<br>Link Attivazione:<br><a href="http://greenbox/arcadia/conferma/?conf=' . $row['conferma'] . '&u=' . $row['id'] . '">http://greenbox/arcadia/conferma/?conf=' . $row['conferma'] . '&u=' . $row['id'] . '</a></div><div id="fade" class="black_overlay"></div></td>';}else{echo '<td>SI</td>';}
echo '<td>' . $row['mail'] . '</td>'; echo '<td>' . $row['lvl'] . '</td>';echo '<td>' . $row['desc_lvl'] . '</td>';echo '<td>' . $IPU . '</td>';echo '<td>' . $data . '</td>';echo '<td>' . $row['pc'] . '</td>';
echo '<td><center><a href="modifica.php?ID=' . $row['id'] . '" ><img src="img/mod.jpg" title="Modifica '.$row['user'].'" width="15" height="15"></a></center></td>';echo '<td><center><a href="cancella.php?ID=' . $row['id'] . '"><img src="img/canc.jpg" title="Cancella '.$row['user'].' ATTENZIONE: la cancellazione e IRREVERSIBILE!!!" width="15" height="15"></a></center></td>';echo "</tr>";}
Tutto funziona perfettamente solo all'interno della condizione:
Codice PHP:
if ($conferma <> "SI")
il risultato sarà, quando vera, solo il primo riscontrato su DB
esempio su db ho questa situazione
ID |
UserName |
Nome |
Cognome |
Password |
Conferma |
Mail |
LVL |
Descrizione permesso |
IP |
Data Online |
Nome PC |
Modifica |
Cancella |
1 |
xxxxxx |
Alan |
|
|
SI |
|
1 |
SuperAdmin |
|
08/02/2018 |
|
|
|
2 |
xxxxxx |
Camillo |
|
|
SI |
|
1 |
SuperAdmin |
|
19/02/2016 |
|
|
|
3 |
xxxxxx |
Ospite |
|
|
SI |
|
1 |
SuperAdmin |
|
01/03/2016 |
|
|
|
4 |
xxxxxx |
Marco |
|
|
NO |
|
1 |
SuperAdmin |
|
07/02/2018 |
|
|
|
5 |
xxxxxx |
Caterina |
|
|
SI |
|
0 |
Utente |
|
07/02/2018 |
|
|
|
6 |
xxxxxx |
Federica |
|
|
NO |
|
1 |
SuperAdmin |
|
07/02/2018 |
|
|
|
( ho cancellato i dati sensibili)
Nella colonna "Conferma" i no dovrebbero avere nel link l'ID proprio, invece mi ritrovo per ogni "NO" il primo id con "NO" in questo caso sempre l'ID = 4
Spero si capisca.