Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/04/2012, 08:25
Bugger
 
Fecha de Ingreso: septiembre-2010
Ubicación: /home/
Mensajes: 103
Antigüedad: 13 años, 7 meses
Puntos: 17
Respuesta: Cargar tabla con consulta

Hola eduardo2009

a mi me gusta separar el código php de lo que es html.
Igualmente lo que te ha puesto Maru77 deberia funcionarte correctamente.

aqui va mi ejemplo :
Código PHP:
<?php  
include("conect.phtml");  
   
$link=Conectarse();  
   
$buscar=$_POST['buscar']; 
   
$result=mysql_query("SELECT * FROM pvclientes Where numcli='".$buscar."' OR nomcli='".$buscar."' ",$link);  
if (
$row mysql_fetch_array($result)){ 
    
?>
    <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 align="center">  
    <TR> 
        <TD width="85" class= "centrado">&nbsp;Codigo</TD> 
        <TD width="285" class= "centrado">&nbsp;Nombre</TD> 
    </TR>  
   <?php
   
while($row mysql_fetch_array($result)) {  
       
?>
       <tr><td><?php echo $row["numcli"];?></td><td><?php echo $row["nomcli"];?></td></tr>
       <?php
        
   
}  
   
mysql_free_result($result);  
   
mysql_close($link);  
} else {  
echo 
"¡ No se ha encontrado ningún registro !";  
}  
?>
Saludos