Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/12/2010, 20:57
Avatar de soy_nicanor
soy_nicanor
 
Fecha de Ingreso: mayo-2010
Mensajes: 374
Antigüedad: 14 años
Puntos: 3
Respuesta: Ayuda urgente por favor

Gracias carlos_belisario

Lo primero que ago es buscar y luego elegir el nombre y trabajar con todos esos datos
Código PHP:
Ver original
  1. <?php
  2. include('busqueda.php');
  3. $link = mysql_connect("localhost", "root", "root");
  4. mysql_select_db("sistema_de_pacientes", $link);
  5. $result = mysql_query("SELECT * FROM nombre_codigo WHERE nombres LIKE '%$buscar%' ORDER BY nombres", $link);
  6. if ($row = mysql_fetch_array($result))
  7. {
  8. $_SESSION["codigo"]=$row["codigo"];
  9. echo '<table width="400" cellspacing="0" cellpadding="3" align="center"';
  10. //Mostramos los nombres de las tablas
  11. echo "<tr>";
  12. echo "<td>"."<strong>CODIGO</strong>"."</td>";
  13. echo "<td>"."<strong>NOMBRE</strong>"."</td>";
  14. echo "<td>"."<strong>APELLIDOS</strong>"."</td>";
  15. echo "<td>"."<strong>DNI</strong>"."</td>";
  16. echo "</tr>";
  17. do {
  18.             echo "<tr>";
  19.             echo '<td><a href="cliente.php"><font size="2" color="#0000FF">
  20.             '.$row["codigo"].'</font></a></td>';
  21.             echo "<td>".$row["nombres"]."</td>";
  22.             echo "<td>".$row["apellidos"]."</td>";  
  23.             echo "<td>".$row["dni"]."</td>";
  24.             echo "</tr>";
  25.     } while ($row = mysql_fetch_array($result));
  26. echo "</table>";
  27. }
  28. else
  29. {
  30. echo "¡ No se ha encontrado ningún registro !";
  31. }
  32. ?>

Lo que estoy recogiendo esta bien?

$_SESSION["codigo"]=$row["codigo"];