Ver Mensaje Individual
  #1  
Antiguo 29-04-2008
georkis georkis is offline
Miembro
 
Registrado: abr 2008
Ubicación: Cuba
Posts: 39
Reputación: 0
georkis Va por buen camino
¿Actualizar varios registros a la vez? Ayuda... por favor

Código PHP:
<form id="form1" name="form1" method="post" action="act_url_jcce.php">
      <table width="100%" border="0" cellspacing="2" cellpadding="0">
        <tr>
          <td width="22%">&nbsp;</td>
          <td width="60%">&nbsp;</td>
          <td width="10%">&nbsp;</td>
          <td width="8%">&nbsp;</td>
        </tr>
        <?php do { ?><tr>
          <td><input name="munic[<?php echo $row_jcce['munic']; ?>]" type="text" id="munic" value="<?php echo $row_jcce['munic']; ?>" size="20" /></td>
          <td><input name="reg[<?php echo $row_jcce['id']; ?>]" type="hidden" id="id" / value="reg[<?php echo $row_jcce['id']; ?>]">
            <input name="url[<?php echo $row_jcce['url']; ?>]" type="text" id="url" value="<?php echo $row_jcce['url']; ?>" size="50" /></td>
          <td><p>.</p>
            <p>
              <input name="sitio" type="hidden" id="sitio" value="<?php echo $row_jcce['sitio']; ?>" />
              </p></td>
          <td>&nbsp;</td>
        </tr>
        <?php } while ($row_jcce mysql_fetch_assoc($jcce)); ?>
        <tr>
          <td><input name="act_jcce" type="submit" id="act_jcce" value="Actualizar" /></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
        </form>

<!-- es esta es la página que procesa los datos -->

<?php require_once('../../Connections/nue.php'); ?>
<?php

/// esto es una array que capta la variable del formulario
if(!empty($_POST['reg'])){
    
$registrosarray_keys($_POST['reg']);
    
$registrosimplode("','"$registros);
    
$registros"'" $registros "'";
    
    
$munarray_keys($_POST['munic']);
    
$munimplode("','"$mun);
    
$mun"'" $mun "'";
    
    
$urlarray_keys($_POST['url']);
    
$urlimplode("','"$url);
    
$url"'" $url "'";
    


  
$updateSQL "UPDATE url_jcce SET munic=$mun, url=$url WHERE id IN ($registros)";
  

  
mysql_select_db($database_nue$nue);
  
$Result1 mysql_query($updateSQL$nue) or die(mysql_error());
  echo 
"se ha modificado los datos satisfactoriamente";
  
// no me sale la función header("Location: link.php?cmg");
}

?>

Última edición por dec fecha: 29-04-2008 a las 22:14:46.
Responder Con Cita