Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Tabella che non scrive l'ultima riga

    Ciao a tutti ho un problemino di array: praticamente ho fatto uno script php che gestisce i voti di un esame. Quando si tratta di prendere gli elementi dai databalse non c'è problema ma quando si tratta di inserire i campi nelle checkbox e nelle textbox non considera l'ultima riga... nn si sa xkè.... però i nomi li scrive tutti nella tabella, è come se l'ultimo ciclo del while venga eseguito a metà...
    Codice PHP:
      <?php   
      error_reporting
    (E_ALL);    
      include 
    "IO.php";    
      
    $ID=$_GET['user'];    
      
    $evento=$_POST['evento'];    
      include 
    "prof_menu.php";     
      
    testa(1,$ID);    connetti(); 
      
    //--------------- ricerca ed estrazion voti --------
      
    $sql mysql_query("
        SELECT IDalunno, voto, Orale
        FROM joomla_votazioni_voti
        WHERE Evento='
    $evento'
      "
    );
      
    $i=false;
      while(
    $r=mysql_fetch_array($sql)){
            
    $alu[]=$r['IDalunno']; 
            
    $voto[]=$r['voto']; 
            
    $orale[]=$r['Orale'];
        
    $i=true;
      };

      
    //------------------------------------------
      
    $ev=mysql_query("    
      SELECT DATE_FORMAT(dates, '%d/%m/%Y')date    
      FROM joomla_eventlist_events    WHERE id='
    $evento' "
      or die(
    mysql_error()); 
      while(
    $r=mysql_fetch_array($ev))
      {echo  
    '<h2>Voti per l\'appello del '.$r['date'].'</h2>';    }?> 
      <div align="center">
      <form method="POST" action="prof_voti_alunni_vota.php?user=<?echo $ID?>&evento=<?echo $evento?>">
      <table>
        <tr><th>Studente</th><th>Voto</th><th>Obbligo orale</th></tr> 
        <?php
        $nomi 
    mysql_query("
    SELECT uu.firstname, uu.lastname, iscritti.id 
    FROM joomla_users u,  joomla_comprofiler uu,
    (SELECT user_id, cb_ingegnere, id
    FROM joomla_votazioni_iscritti
    WHERE event='
    $evento' AND cb_ingegnere IN
        (SELECT ii.ing
        FROM joomla_votazioni_prof_ing ii,
                (SELECT ID,corso
                FROM joomla_votazioni_prof
                WHERE professore='
    $ID')c
        WHERE c.ID=ii.IDprof)
    )iscritti
    WHERE iscritti.user_id=u.id AND iscritti.user_id=uu.user_id
    ORDER BY uu.lastname
        "
    ) or die(mysql_error()); disconnetti();
        while(
    $r=mysql_fetch_array($nomi)){ 
            echo 
    '<tr><td>'.htmlentities(ucwords($r['lastname'])).' '.htmlentities(ucwords($r['firstname'])).'</td>
            <td><input maxlength="2" size="10" name="voto[]" tabindex="0"'
    ;
            
    $k=false;
            if(
    $i==true){$k=array_search($r['id'], $alu);}
            if (
    $k!=false){
             echo 
    ' value="'$voto[$k].'"';
            }
            echo
    ' /></td>    
            <td><input name="orale[]" type="checkbox" value="'
    .$r['id']. '"';
            if (
    $k!=false && $orale[$k]==1){
            echo 
    ' checked="checked" ';
            }
            echo 
    '/>
            <input name="id[]" type="hidden" value="'
    .$r['id'].'"/>
            </td></tr>'
    ;
        }
        
    ?>
    </table>  
    <input value="Invia i voti" type="submit"> 
    </form>
    </div>
    </body> </html>

  2. #2

    RISOLTO

    ho messo

    $alu[0]=-1
    $voto[0]=-1
    $orale[0]=-1

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.