How to edit a record and update immediately

Asked

Viewed 37 times

0

How do I get the user to edit the value of presenca('P','F') and update in the database

<table  class="pauta">
    <?php 
    $consultaAluno=mysqli_query($conexao,"SELECT a.matriculaAluno, a.nomeAluno,aht.turma_codigoTurma FROM aluno a,aluno_has_turma aht WHERE a.matriculaAluno=aht.aluno_matriculaAluno AND aht.turma_codigoTurma='$codigoTurma'");
    $rowAluno = mysqli_num_rows($consultaAluno);
    $cont=0;
        while ($cont < $rowAluno){
                $linhaAluno=mysqli_fetch_assoc($consultaAluno);
            echo ("<tr>
                <td rowspan='2' style='width: 15%'>".$linhaAluno['matriculaAluno']."</td>
                <td rowspan='2' style='width: 40%'>".$linhaAluno['nomeAluno']."</td>
                <td rowspan='2' style='width: 10%'>11</td>

                </tr>");
                $matriculaAluno=$linhaAluno['matriculaAluno']?$linhaAluno['matriculaAluno']:"";
            $consultaPresenca=mysqli_query($conexao,"SELECT p.presenca FROM pauta p, aluno_has_pauta ahp, aluno a WHERE '$matriculaAluno' = a.matriculaAluno AND ahp.pauta_idPauta = p.idPauta AND '$matriculaAluno' = ahp.aluno_matriculaAluno");
            $rowPresenca = mysqli_num_rows($consultaPresenca);
            $contP=0;
            echo ("<tr>");
            while($contP < $rowPresenca){
                **$linhaPresenca=mysqli_fetch_assoc($consultaPresenca);
                $presenca=$linhaPresenca['presenca'];
                    echo ("<td>".$presenca."</td>");**

                $contP++;
            }
            echo ("<tr>");
            $cont++;
            };

            ?>
    </table>

Currently it is as follows, like that the user could edit the presence.

inserir a descrição da imagem aqui

  • This code is only for showing the table above, not for editing. So you want two things, one is to have the code to edit and another is to have it recorded without a "confirm" button or something like that, right?

  • Perfect, I want the user to be able to edit the field presenca('F','P'), or have a checkbox that can change from missing to present and vise and versa. I’m new in development can’t do

  • It is a broad answer to put here, because here it is based on specific doubts and in your case there is need for a broader study of languages. Important is that you understand that PHP runs on the server side, so the data entry negotiations are done on the client side, and then submitted to the server, where PHP will act. For this you must use Javascript, Jquery, etc.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.