Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/06/2012, 17:57
Avatar de avalos22
avalos22
 
Fecha de Ingreso: marzo-2012
Mensajes: 45
Antigüedad: 12 años, 1 mes
Puntos: 2
Respuesta: Modificar mediante while

Código HTML:
<table id="datos" cellspacing="0" class="display">
	<thead>
		 <tr>
			<th>id</th>
			<th>nombre ciudad</th>
			<th>usuario</th>
            <th>Modificar</th>
		</tr>
	</thead>
	<tbody>
    <?php while($fila=mysql_fetch_array($ConsultaMySql)){?>
		<tr>
        		<td ><?php echo $fila['id'];?></td>
                <td><?php echo $fila['nombre'];?></td>
                <td><?php echo $fila['usuarios'];?></td>
                <td><input type="button" name="Modificar" onclick="Modificar(<?php echo $fila['id']; ?>)" />
    </td></tr>
        <?php } ?>
	</tbody>
</table> 


Como puedes ver en el Boton de Modificar se manda el id de la fila... ya con el id puedes hacer el update
Haces el formulario que te cargue los datos de esa fila en unos inputs obviamente el id no lo puede modificar, y haces el update y listo!

Código PHP:

$modif 
mysql_query("UPDATE ciudades SET , nombre='$Datoamodificar' where id='$id'",$cnx) or die(mysql_error()); 

Si no entendi bien lo que deseas hacer explícame mas cosas estoy para ayudarte.. Saludos!