Tema: Pedidos PHP
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/11/2009, 14:39
[email protected]
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 19 años, 4 meses
Puntos: 1
Pedidos PHP

La intension es buscar codigo en tabla una tabla de datos ya existente.
A medida que 'Agrego al Pedido', ir armando la muestra (item-codigo-descripcion-cantidad).
No funciona la iteracion de los productos, una vez encontrado en la base
el campo item se debe ir incrementado a medida de los item desplegados en la iteracion.
Mostrar titulo solo cuando item = 1
Espero haberme dado a entender.
Código PHP:
<?                                                                              
 $titulo
="Solicitud de Productos a Bodega";                                     
 
$elige=$_GET["elige"];                                                         
 
$item=$_REQUEST['item'];                                                       
?>                                                                              
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">                                      
 <html>                                                                         
 <head>                                                                         
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />    
  <title>Solicitudes a Bodega</title>                                           
<style type="text/css">                                                         
<!--                                                                            
#procesar { font-family: "Trebuchet MS"; font-size: 10px; font-weight: bold; text-transform: uppercase; color: #000066; background-color: #F1F1F1; border: 1px solid #666666; }
.Estilo1 {font-family: "Trebuchet MS"; font-size: 10px; font-weight: bold; color: #000066; text-transform: uppercase;}                                                                               
.Estilo2 {font-family: "Trebuchet MS"; font-size: 10px; }                                                                               
#linea {border-collapse:collapse; border-color:#00379B;}                        
-->                                                                             
</style>                                                                        
</head>                                                                        
<body>                                                                         
 <div align=center><span style="width:100%; font-size: 12px; font-family: Verdana; color: #00379B; font-weight: bold;"><? echo $titulo?></span></div>         
 <form action="solicitud.php" method="get">                                     
 <table width=97% border=1 cellspacing=0 cellpadding=2 align=center id=linea>   
  <tr class=datos>                                                              
    <td colspan=2 bgcolor=#00379B id=linea>B&uacute;squeda de Productos</td>    
  </tr>                                                                         
  <tr class=Estilo2>                                                            
    <td align=center valign=middle id=linea>                                    
     <input name="elige" type="text" id="elige" value=".:: Codigo de Producto ::
." size="50" maxlength="40" onfocus="if(this.value !=''){this.value=''; };return
 true;"/>&nbsp;<input type="submit" name="submit" id="procesar" value="Agregar a
 Pedido">                                                                       
    </td>                                                                       
  </tr>                                                                         
</table>                                                                        
</form><br>                                                                     
<?                                                                              
 
if(!isset($elige) == '')                                                       
 {                                                                              
   include(
"config.php");                                                       
   
$sql=mysql_query("select * from EXIPRO where CODPRO_P=$elige limit 0,1") or die("Problemas con conexion..<b>".mysql_error()."</b>");                         
   
$numeroRegistros=mysql_num_rows($sql);                                       
   if(
$numeroRegistros 0)                                                     
   {                                                                            
      
//Para generar item NO FUNCIONA.
      
if(!isset($item) == '') { $item=1; }                                      
      else { 
$item=$item+1; }                                                   
      if(
$item == 1)                                                            
      {                                                                         
      echo 
"<table width=97% border=1 cellspacing=0 cellpadding=2 align=center id=linea>                                                                        
             <tr class=Estilo1 bgcolor=#F1F1F1>                                 
              <td width=06% align=center id=linea>Item</td>                     
              <td width=15% align=center id=linea>C&oacute;digo</td>            
              <td width=55% align=center id=linea>Descripci&oacute;n</td>       
              <td width=10% align=center id=linea>Cantidad</td>                 
              <td width=14% align=center id=linea>Opciones</td>                 
             </tr>"
;                                                            
       }                                                                        
       
$fila=mysql_fetch_array($sql);                                           
       
$cod=$fila['CODPRO_P'];                                                  
       
$nom=$fila['NOMBRE_P'];                                                  
       
$cos=$fila['PRECOS_P'];                                                  
       
?>                                                                       
             <tr class=Estilo2>                                                 
              <td width=06% align=right id=linea><? echo $item?></td>         
              <td width=15% align=right id=linea><? echo $cod;  ?></td>         
              <td width=55% align=left  id=linea><? echo $nom;  ?></td>         
              <td width=10% align=right id=linea>&nbsp;</td>                    
              <td width=14% align=right id=linea>&nbsp;</td>                    
             </tr>                                                              
       <?                                                                       
   
}                                                                          
 }                                                                           
?>        
 </table> 
 </body>  
 </html>
Con este codigo siempre se me itera el titulo con el resultado de la consulta; es decir al parecer item siempre es = 1.

desde ya se agradece cualquier comentaria al respecto.