Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/01/2015, 06:46
guillegodino
 
Fecha de Ingreso: junio-2009
Mensajes: 16
Antigüedad: 14 años, 10 meses
Puntos: 0
Información Consulta php y mysql. Repite datos.

Hola, nuevamente recurro a vosotros porque tengo un código PHP el cual se conecta a la bd para el inicio de sesion. En caso que el usuario se loguea de forma correcta le aparece una tabla con los respectivos botones.
Pero resulta que me aparece la tabla repetida con todos los botones.
No se donde le estoy errando, y estoy bastante olvidado con PHP.
Código PHP:
Ver original
  1. <?php
  2. ?>
  3. <html> 
  4.     <head>
  5.             <title>Página privada alumnos y profesores.</title>
  6. </head>
  7. <body class="fondo">
  8.     <div id="menu">
  9.       <asp:Repeater ID="MenuItems" runat="server">
  10.           <ItemTemplate>
  11.          
  12. <table align="center">
  13.     <tr>
  14.         <td>
  15.        
  16.              <?php
  17. if (isset($_SESSION['k_username'])) {
  18.    
  19. $link = @mysql_connect ("localhost", "root","root");
  20. $conex=@mysql_select_db("examen",$link);
  21. $usuario = email;
  22. $sql = "SELECT *
  23.        FROM persona
  24.        WHERE email=$usuario";
  25.        
  26. $result = mysql_query($sql,$link);
  27.  
  28.  while ($reg = mysql_fetch_array($result)) {
  29.    
  30.  echo "<table border='1px' text-align='center'>";
  31.  
  32.    
  33.     echo "<tr>";
  34.         echo "<td>";echo 'Bienvenido, '.$_SESSION['ncompleto'];
  35.         echo "</td>";
  36.        
  37.         echo "<td>";
  38.             echo '<a href="logout.php" >(Salir)</a> ';
  39.         echo "</td>";
  40.     echo "</tr>";
  41.        
  42.     echo "<tr>";
  43.         echo "<td colspan='2' align='center'>Examenes</td>";
  44.     echo "</tr>";
  45.    
  46.     echo "<tr>";
  47.    
  48.         echo "<td>";
  49.             echo '<input type="button" value="Ver examenes." onclick="window.location.href=\'examenes/verexamenes.php\'"/>';
  50.         echo "</td>";
  51.        
  52.         echo "<td>";
  53.             echo '<input type="button" value="Agregar examenes." onclick="window.location.href=\'examenes/altas/formAltasDeExamenes.php\'"/>';
  54.         echo "</td>";
  55.     echo "</tr>";
  56.    
  57.     echo "<tr>";
  58.         echo "<td colspan='2' align='center'>Personas</td>";
  59.     echo "</tr>";
  60.     echo "<tr>";
  61.    
  62.         echo "<td>";
  63.             echo '<input type="button" value="Ver personas." disabled="true"/>';
  64.         echo "</td>";
  65.        
  66.         echo "<td>";
  67.             echo '<input type="button" value="Agregar personas." onclick="window.location.href=\'persona/altaspersona/altapersona.htm\'"/>';
  68.         echo "</td>";
  69.     echo "</tr>";
  70.    
  71.         echo "<tr>";
  72.         echo "<td colspan='2' align='center'>Profesores</td>";
  73.     echo "</tr>";
  74.     echo "<tr>";
  75.    
  76.         echo "<td>";
  77.             echo '<input type="button" value="Ver profesores." disabled="true"/>';
  78.         echo "</td>";
  79.        
  80.         echo "<td>";
  81.             echo '<input type="button" value="Agregar profesores." disabled=tue/>';
  82.         echo "</td>";
  83.     echo "</tr>";
  84.    
  85.    
  86.     echo "<tr>";
  87.         echo "<td colspan='2' align='center'>Alumnos</td>";
  88.     echo "</tr>";
  89.    
  90.     echo "<tr>";
  91.         echo "<td>";
  92.             echo '<input type="button" value="Ver alumnos." disabled="true"/>';
  93.         echo "</td>";
  94.        
  95.         echo "<td>";
  96.             echo '<input type="button" value="Agregar alumnos." disabled=tue/>';
  97.         echo "</td>";
  98.     echo "</tr>";
  99.    
  100.  
  101.     echo "<tr>";
  102.         echo "<td colspan='2' align='center'>Grupo</td>";
  103.     echo "</tr>";
  104.    
  105.     echo "<tr>";
  106.         echo "<td>";
  107.             echo '<input type="button" value="Ver grupos." disabled="true"/>';
  108.         echo "</td>";
  109.        
  110.         echo "<td>";
  111.             echo '<input type="button" value="Agregar grupos." disabled=tue/>';
  112.         echo "</td>";
  113.     echo "</tr>";
  114.    
  115.    
  116.         echo "<tr>";
  117.         echo "<td colspan='2' align='center'>Instituto.</td>";
  118.     echo "</tr>";
  119.    
  120.     echo "<tr>";
  121.         echo "<td>";
  122.             echo '<input type="button" value="Ver instituto." disabled="true"/>';
  123.         echo "</td>";
  124.        
  125.         echo "<td>";
  126.             echo '<input type="button" value="Agregar instituto." disabled=tue/>';
  127.         echo "</td>";
  128.     echo "</tr>";
  129.  echo "</table>";
  130.  
  131.              }
  132.  
  133. echo "<div class='fecha'>";
  134.             echo "Hoy es ";
  135.             echo date("l ");
  136.             echo date("d ");
  137.             echo "de ";
  138.             echo date("F ");
  139.             echo "de ";
  140.             echo date("Y");
  141.             echo "</div>";
  142.                
  143. @mysql_close ($link);
  144. }else{
  145.     echo '<img src=materiales/error.jpg width=50px height=50px></br>Usted no se ha logueado correctamente. Por favor hagalo clickeando <a href="login.php">aqui.</a></p>';
  146. }
  147.  
  148.     ?>
  149.         </td>
  150.         <td align="rigth">
  151.        
  152.         </td>
  153.     </tr>  
  154. </table>
  155.  
  156.          </ItemTemplate>
  157.     </asp:Repeater>
  158.       </div>
  159. </body>
  160. </html>
Gracias a quien me pueda ayudar.