Ver Mensaje Individual
  #8 (permalink)  
Antiguo 12/12/2010, 23:06
Arcana
 
Fecha de Ingreso: mayo-2010
Mensajes: 185
Antigüedad: 13 años, 11 meses
Puntos: 2
Respuesta: como usar una SESSION

Prueba asi:

Código PHP:
   1.
      <?php
      session_start
()
   
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?='.$row["codigo"].'?"><font size=2 color=#0000FF>'.$row["codigo"].'</a></font></td>";
  
20.
                  
echo "<td>".$row["nombres"]."</td>";
  
21.
                  
echo "<td>".$row["apellidos"]."</td>";  
  
22.
                  
echo "<td>".$row["dni"]."</td>";
  
23.
                  
echo "</tr>";
  
24.
          
} while ($row mysql_fetch_array($result));
  
25.
      
echo "</table>";
  
26.
      
}
  
27.
      
else
  
28.
      
{
  
29.
      
echo "¡ No se ha encontrado ningún registro !";
  
30.
      
}
  
31.
      ?>

No soy experto, pero creo q debe de funcionar, soy nuevo en esto!