Salve a tutti, allora ho creato una lista in cui mi fà vedere tutti gli utenti registrati, solo che non mi fà vedere il primo utente, cioè inizia dal 2:
PHP:
<?php
require_once __DIR__ . '/header.php';
$query_registrati = "SELECT * FROM iscritti";
$elencoregistrati = mysql_query($query_registrati) or die(mysql_error());
$row_elencoregistrati = mysql_fetch_assoc($elencoregistrati);
if(isset($_POST['cancella'])){
// verifica
if(is_array($_POST['id'])){
foreach($_POST['id'] as $id){
if($id !="" && is_numeric($id)){
$query = "DELETE FROM iscritti WHERE id_utente=$id";
$ris=mysql_query($query);
if($query) echo '<meta http-equiv="refresh" content="2;url=registralista.php"> ';
}
}
}
}
?>
<?php require_once __DIR__ . '/sidebar.php'; ?>
<section id="main" class="column">
<?php
if(isset($_POST['cancella'])){
if($query) echo '<h4 class="alert_success">Utente Cancellato</h4>';
else echo '<h4 class="alert_error">Utente non Cancellato</h4>';
}
else {
echo '<h4 class="alert_info">L\'amministratore viene nascosto dalla lista</h4>';
}
?>
<div class="clear"></div>
<article class="module width_3_quarter">
<header><h3 class="tabs_involved">Gestione Utenti</h3>
</header>
<div class="tab_container">
<div id="tab1" class="tab_content">
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th>Nome</th>
<th>Username</th>
<th>Email</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
<?php
$per_nome=0;
while ($row_elencoregistrati = mysql_fetch_assoc($elencoregistrati)){
$name_form="form".$per_nome;
echo '
<tr>
<td>'.$row_elencoregistrati['nome_reale'].'</td>
<td>'.$row_elencoregistrati['nome_utente'].'</td>
<td>'.$row_elencoregistrati['email'].'</td>
<td align="center" class="contact" width="10%">
<form name="$name_form" method="post" action='.$_SERVER['PHP_SELF'].'>
<input name="id[]" type="hidden" id="id" value="'.$row_elencoregistrati['id_utente'].'">
<input type="submit" name="cancella[]" value="Cancella">
</form>
</td>
</tr>
';
}
?>
</tbody>
</table>
</div><!-- end of #tab1 -->
</div><!-- end of .tab_container -->
</article><!-- end of content manager article -->
<div class="spacer"></div>
</section>