Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/11/2013, 10:36
orw28
 
Fecha de Ingreso: agosto-2009
Ubicación: Venezuela
Mensajes: 82
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Problema para actualizar datos con un while

Disculpa, q tonteria, se me olvido poner el while, ups!.. Lo q pasa es que resumi el codigo para mostrar solo lo necesario y se entendiera y olvidé esribir el while que me imprime los 3 registros(q uso como ejemplo), cada uno con el campo "Cantidad" editable.. Sorry!!!

Código HTML:
<form action="javascript: fn_modificar();" method="post" name="frm_per" id="frm_per">
<input type="hidden" id="id" name="id" value="<?=$_POST['codigo_venta']?>" />
<table>
        <tr>
	<th>Nro de Venta</th>
        <th>Producto</th>
	<th>Cantidad</th>
	<th>Precio/Unidad</th>
        </tr> 
Código PHP:
    <?php
        
while ($rs_per $paging->fetchResultado()){
        
$cod=$rs_per['codigo_venta'];
        
$prod=$rs_per['id'];

        
$producto=mysql_query("SELECT * FROM productos where id='$prod'");
        
$otro=mysql_fetch_array($producto);
        
$namepro=$otro['nombre_produc'];
        
$idprod=$otro['id'];

    
?>
Código HTML:
<td><?=$rs_per['codigo_venta']?></td>
    <td><input type="hidden" name="producto" id="producto" value="<?=$otro['id']?>"><?=$namepro?></td>
    <td><input type="text" name="cantidad" size="10" value="<?=$rs_per['cantidad']?>"></td>
    <td><?=$rs_per['precio']?></td>
    </tr> 
Código PHP:
<? ?>
<tr>
<input type="submit" value="Modificar" name="modificar">
<input name="cancelar" type="button" id="cancelar" value="Cerrar" onclick="fn_cerrar();" />
</td>
</tr>
</tfoot>
</table>
</form>

Asi que me muestra un form de esta manera, mas o menos:
_______________________________________
|Venta | Product | Cant| Precio |
| 10 |Laptop-----| 2----| 1234 |
| 10 |TV-----------|4-----| 5678 |
| 10 |Celular-----|8-----| 9876 |

Donde puedo editar cada una de las cantidades, pero edito las 3, y se modifica solo la de "Celular"... Espero ahora si haberme explicado