Foros del Web » Programando para Internet » PHP »

código buscar e imprimir PHP

Estas en el tema de código buscar e imprimir PHP en el foro de PHP en Foros del Web. hola chicos necesito su ayuda con este código.. aquí yo hago una consulta para buscar en la base de datos, pero al introducir el código ...
  #1 (permalink)  
Antiguo 02/03/2012, 10:39
 
Fecha de Ingreso: febrero-2010
Mensajes: 10
Antigüedad: 14 años, 1 mes
Puntos: 0
Exclamación código buscar e imprimir PHP

hola chicos necesito su ayuda con este código.. aquí yo hago una consulta para buscar en la base de datos, pero al introducir el código pareciera q no recibiera la variable, no encuentro cual es el problema que presenta..

Código HTML:
require ("conectar.php");
		$busca=$_POST['busca'];
		$secion=$_SESSION['busca']=$busca;
		
		$consulta= ibase_query ("SELECT * FROM DOCTOR WHERE CI_COLEGIO='$secion'")or die("No se pudo realizar la consulta a la Base de Datos".ibase_errmsg());
		$resultado=ibase_fetch_assoc($consulta);
		
	?>  
    <table align="center" width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Registros de Doctores</td>
  </tr>
  <tr>
    <td><table align="center" width="600" border="0" cellspacing="0">
            <tr>
              <td>
              <form id="form1" name="form1" method="post" action="L_Doct.php?bus=$secion">
              <table align="right" width="200" border="0" cellspacing="0" cellpadding="0">
  				<tr>
    			<td>Buscar 
                <input name="busca" type="text" id="busca" value="<?php echo $_SESSION['busca'];?>" size="12" />
                <input type="image" src="../imagenes/Start-Menu-Search-icon.png" width="20" height="20" style="cursor:pointer"/>
                </td>
 			 	</tr>
				</table>
				</form>
              </td>
              </tr>
            <?php 
  	if(isset ($resultado['id']) && $resultado['id']!="")
	{
		?>
	 		<tr>
              <td><table align="center" width="390" border="0" cellspacing="0" cellpadding="0">
  				<tr>
    			<td width="130">Codigo Colegio</td>
   				 <td width="100">Nombre</td>
   				 <td width="100">Apellido</td>
                 <td width="60">Acciones</td>
 				 </tr>
				</table>
			</td>
			
     		
            </tr><?php 
			
			
			
			do{?>
            <tr>
             <td>
             <table align="center" width="390" border="0" cellspacing="0" cellpadding="0">
 			<tr>
    		  <td width="130"><?php echo $resultado['CI_COLEGIO'];?> </td>
              <td width="100"><?php echo $resultado['NOMBRE_D'];?></td>
              <td width="100"><?php echo $resultado['APELLIDO_D'];?></td>
              <td width="30"><a href="M_Doctor.php?id=<?php echo $resultado['id'];?>"><img src="../imagenes/sync-icon.png" width="20" height="20" /></a></td>
              <td width="30"><a href="E_Doctor.php?id=<?php echo $resultado['id'];?>"><img src="../imagenes/cancel-icon.png" width="20" height="20" /></a></td>
 			</tr>
			<?php }while($resultado=ibase_fetch_assoc($consulta));?>
			</table>

             </td>
            </tr>
           <?php   }
  /*else
  {
		echo"<tr><td align='center' colspan='7'>Sin resultados</td></tr>";  
  }*/?>
          </table></td>
  </tr>
</table> 
  #2 (permalink)  
Antiguo 02/03/2012, 11:02
Colaborador
 
Fecha de Ingreso: mayo-2008
Ubicación: $MX['VZ']['Xalapa']
Mensajes: 3.005
Antigüedad: 15 años, 11 meses
Puntos: 528
Respuesta: código buscar e imprimir PHP

¿Y estás seguro que envías bien el formulario?
Por otra parte, estas lineas no tienen mucho sentido:
$busca=$_POST['busca'];
$secion=$_SESSION['busca']=$busca;
Si quieres colocar el valor de $_SESSION['busca'] en dos variables tan sólo sería así:

$secion=$busca=$_SESSION['busca'];

Etiquetas: registro, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:48.