
06/08/2008, 19:55
|
| | Fecha de Ingreso: febrero-2007
Mensajes: 18
Antigüedad: 18 años Puntos: 0 | |
Respuesta: Ayuda con while Muchas gracias por la ayuda, he quitado la linea que me ha sugerido y el resultado ya es correcto, solo que me crea un inconveniente, la tabla que genera el resultado es para actualizar la información de la base de datos, y al darle update si me actualiza los registros, pero ahora me borra todos los demás... aqui dejo el código de la página que hace el update:
<?php
if($_POST['Submit']){ // If receive Submit button variable.
// Select all data records in table "reportes" and put them into $result.
$result=mysql_query("select idreportes from reportestest order by idreportes asc");
// Fetch record rows in $result by while loop and put them into $row.
while($row1=mysql_fetch_assoc($result)){
// Get the posted value "name_ID value" from form.php. This variable change it's value by while loop.
$reportado=$_POST["reportado_".$row1[idreportes]];
$retardos=$_POST["retardos_".$row1[idreportes]];
$faltas=$_POST["faltas_".$row1[idreportes]];
// Update field "name", matching with "id" value by while loop.
mysql_query("update reportestest set reportado='$reportado', retardos='$retardos', faltas='$faltas' where idreportes='$row1[idreportes]'");
}
echo "--- Actualización completa ---";
}
?> |