Show data on screen according to clicked ID

1

Hello, I have a small problem here, maybe easy to solve, but I can not. I have a first screen (alumn.php) where you will have several search terms, and one of them will be by study time, where they will bring me some results from the database. So far everything works perfectly. Follow the print of the search screen.

Hereisthecodeforthissearchtowork:

<?phpif($startaction==5){if($acao=="search_time") {
                                                                    if(empty($_POST['select_time'])) {
                                                                        echo'<script type="text/javascript">abre_modal( \'#dialog\' );</script>';
                                                                    } else {
                                                                    //pegar nome via post
                                                                    $searched_time = $_POST['select_time'];
                                                                    $result = mysql_query("SELECT * FROM alunos WHERE Dia_Horario LIKE '%".$searched_time."%' " );
                                                        $check_time = mysql_num_rows($result);
                                                                        if($check_time >= 1){
                                                                             while($ln = mysql_fetch_array($result)) {
                                                                                $radio = $ln['ID'];
                                                                                $id = $ln['ID'];
                                                                                $full_name = $ln['Nome_completo'];
                                                                                $hora_estudo = $ln['Dia_Horario'];

                                                        ?>

                            <div class="scroll-y">

                                <tr>
                                    <td> <a data-toggle="modal" data-target="#dialog01" href="#<?php echo $radio; ?>"> Clicar Aqui</a></td>
                                    <a href="">
                                        <td>
                                            <?php echo $id; ?>
                                        </td>
                                    </a>
                                    <td>
                                        <a href='http://www.dpaulatreinamentos.com/system/teste03/views/pages/aluno.php?id_aluno=<?php echo $id; ?>' class='nomecompleto' title='".$full_name."'>
                                            <?php echo $full_name ?>
                                        </a>
                                    </td>
                                    <td>
                                        <?php echo $hora_estudo; ?>
                                    </td>
                                </tr>

                            </div>


                            <?php

                                                                } } else {
                                                                    echo'<script type="text/javascript">abre_modal( \'#dialog\' );</script>';

                                                                }
                                                                }
                                                            }

                                                            }

                                ?>   

After clicking on the student's name, a new page is loaded, this page will have the complete student data, but with fields for editing where I can work with this student only, register new classes, change data but only this student, is already pulling the id in the link and loading the new page already with the ID in the URL, but the data does not appear, it follows print from the second screen.

HereispartofthecodeIput:

<?php$searched_time=$_POST['select_time'];$pegaid=$_GET["ID"];
                                                                    $result = mysql_query("SELECT * FROM alunos WHERE ID = '$pegaid'" );
                                                        $check_time = mysql_num_rows($result);
                                                                        if($check_time >= 1){
                                                                             while($ln = mysql_fetch_array($result)) {
                                                                                $radio = $ln['ID'];
                                                                                $id = $ln['ID'];
                                                                                $full_name = $ln['Nome_completo'];
                                                                                $hora_estudo = $ln['Dia_Horario'];

       echo $id;                           

  ?>
   <form>
     <?php echo $pegaid; ?>
     <input type="text" class="txt-medium bradius" value="<?php echo $full_name; ?>"/>
     <input type="submit" value="Atualizar" class="sb-search-medium" />
  </form>
</div>
<footer>

</footer>

Could someone help me? If so, thank you very much.

    
asked by anonymous 05.02.2017 / 15:55

2 answers

1

I first advise you to work on mysqli then you can just select table that is

SELECT * FROM alunos

After you give

<? php while($ln = mysqli_fetch_assoc($result)){ ?>

Then list each one that will only display and / or edit

<div id="<?php echo $ln['id']; ?>">

<h4><?php echo $ln['Nome_completo']; ?></h4>
<p><?php echo $ln['Dia_Horario']; ?></p>

</div>

And do not forget to date while

<?php } ?>

Of course, to update some functions of the bank you will need to use the update.

    
05.02.2017 / 18:14
1

It is not working because in your print the name of the variable is (id_aluno), however in your script you are trying to redeem (ID).

Then this is not it: $ pegaid = $ _GET ["ID"];

And yes this: $ pegaid = $ _GET ["child_id"];

That should be the reason, without a student there is no return, right?

    
05.02.2017 / 22:52