 
			
				18/07/2015, 11:44
			
			
			     |  
      |    |    |    Fecha de Ingreso: mayo-2010  
						Mensajes: 30
					  Antigüedad: 15 años, 5 meses Puntos: 0     |        |  
  |      Respuesta: ¿Cómo actualizar registros de bases de datos MYSQL con php?        YA ME DIO LA SOLUCIÓN: No fue necesario el FOR  sino solo con el WHILE  y poner el FORM  dentro del WHILE.   
ESTE ES EL CÓDIGO:    
<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>Documento sin título</title> 
</head>   
<body> 
<p class="mio">VER REGISTRO DE GASTOS DE LOS FRAILES ESTUDIANTES 
<form action="" method="post"> 
  <span class="mio"> 
    <input type="submit" value="Ver registro de gastos de todos los frailes" name="ver_lista_gastos" > 
  </span> 
</form> 
<table style="width: 100%">   
 <?php  
 $conexion=mysqli_connect("localhost","root","","si  ndicatura") or die("Problemas con la conexión"); 
 $consulta=mysqli_query($conexion,"SELECT `id_item`, `item_pedido`, `fecha_peticion`, `costo`, `estado_aprobacion`, `nombre_quien_aprueba`, `fecha_aprobacion` FROM `registros`;") or 
  die("Problemas en el select:".mysqli_error($conexion));  
echo "<table width='847' border='1' cellspacing='2' cellpadding='3'> \n 
<tr> 
    <th width='85' bgcolor='#999999' scope='col'>ID ITEM</th> 
    <th width='195' bgcolor='#999999' scope='col'>SOLICITUD</th> 
    <th width='87' bgcolor='#999999' scope='col'>FECHA DE SOLICITUD</th> 
    <th width='72' bgcolor='#999999' scope='col'>COSTO</th> 
    <th width='111' bgcolor='#999999' scope='col'>ESTADO DE LA SOLICITUD</th> 
    <th width='115' bgcolor='#999999' scope='col'>NOMBRE DE QUIEN APRUEBA</th> 
    <th width='107' bgcolor='#999999' scope='col'>FECHA DE APROBACION</th> 
  </tr> 
";     
  ?>   
  <?php  
while($registro = mysqli_fetch_array($consulta)) 
{  
?><form action="" method="post"> 
   <td><input type="text" value="<?php echo $registro['id_item']?>" name="id_item"></td> 
  <td><input type="text" value="<?php echo $registro['item_pedido']?>" name="nombres[]"></td> 
    <td><input type="text" value="<?php echo $registro['fecha_peticion']?>" name="departamento[]" class="letrapequeña" ></td> 
	<td><input type="text" value="<?php echo $registro['costo']?>" name="idempleado[]"></td> 
        <td><input type="text" value="<?php echo $registro['estado_aprobacion']?>" name="nombres[]"></td> 
    <td><input type="text" value="<?php echo $registro['nombre_quien_aprueba']?>" name="departamento[]" class="letrapequeña" ></td> 
	<td><input type="text" value="<?php echo $registro['fecha_aprobacion']?>" name="idempleado[]"></td> 
	<td> 
    <input type="submit" value="APROBAR gastos" name="aprobar" ></form> </td>   
 </tr>   
<?php  
 }   
 if(isset($_POST['aprobar'])){ 
 $id_item2=$registro['id_item'];   
mysqli_query($conexion,"UPDATE `sindicatura`.`registros` SET `estado_aprobacion` = 'APROBADO' WHERE `registros`.`id_item` = '$_POST[id_item]';"); 
	}    
?>     
  </table>  
</body>	 
</html>     
Gracias a las personas del foro que se interesaron por ayudarme.           |