Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/01/2009, 14:14
Maye422
 
Fecha de Ingreso: enero-2009
Mensajes: 7
Antigüedad: 15 años, 4 meses
Puntos: 0
Exclamación Problemas al actualizar registro en base de datos mysql

Hola tengo un problema cuando voy a actualizar un registro en mi base de datos, ya que aparentemente el registro se actualiza, pero cuando voy y miro en las tblas de mysql, el registro sigue igual, es decir, realmente no se ha realizado la actualizacion.

LA logica usada es la siguiente:

tengo una pagina llamada ActCliente.php, basicamente lo que esta pagina hace es pedir el numero de identificacion del usuario que deseo actualizar atraves de un pequeño formulario, y una vez pulsado el boton "enviar", la pagina me envia a otra pagina llamada visualizarC.php

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Actualizar Cliente</title>
<style type="text/css">
<!--
body {
	background-color: #D3D0AF;
}
-->
</style></head>

<body class="sub">
<form action="visualizarC.php" method="post" name="form1">
<table width="252" border="0" align="center">
  <tr>
    <td width="246" height="157" bgcolor="#D3D0AF"><p>Digite identificacion del Cliente que desea Actualizar</p>
      <form id="form1" name="form1" method="post" action="">
        <label>Identificacion
          <input type="text" name="identificacion" />
        </label>
    </form>      
    </td>
  </tr>
</table>
<label>
      	<div align="center">
      	  <input name="enviar" type="submit" id="enviar" value="Enviar" />
          <input name="cancelar" type="reset" id="cancelar" value="Cancelar" />
</div>
</label>
  </FORM>
</body>
</html> 

*****visualizarC.php****
esta pagina muestra el contenido de los registros pertencientes a el id digitado anteriormente, y a traves de un enlace lo envia (dependiendo de lo que el ususrio quiera modificar) a otra pagina llamada NewId.php (en este caso quiero modificar el id, por eso lo envia a esa pagina)

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Visualizar</title>
[PHP]<?php
require_once('conexion.php');
$id=$_POST["identificacion"];
$sql= "SELECT identificacion, nombre, direccion, telefono FROM cliente WHERE identificacion='$id'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
if ($row)
{
$name = $row["nombre"];
$dir = $row["direccion"];
$tel = $row["telefono"];
 
 printf("<td><font face=Tahoma color=#000000><b>Identificacion:</b></font></td><td>&nbsp;%s</td>", $id);

//envio a traves de un enlace (cambiar) el id del usuario que quiero modificar
 echo '<a href="NewId.php?id='.$id.'">cambiar</a>'; 
 printf("<td><font face=Tahoma color=#000000><b>Nombre:</b></font></td><td>&nbsp;%s</td>", $name); 
 echo '<a href="actNm.php?id='.$id.'">cambiar</a>'; 
 printf("<td><font face=Tahoma color=#000000><b>Direccion:</b></font></td><td>&nbsp;%s</td>", $dire); 
 echo '<a href="actDr.php?id='.$id.'">cambiar</a>'; 
 printf("<td><font face=Tahoma color=#000000><b>Telefono:</b></font></td><td>&nbsp;%s</td>", $tel); 
 echo '<a href="actTel.php?id='.$id.'">cambiar</a>'; 
 
 
 
 	
}
else 
echo"<script>alert ('Registro  no encontrado en la Base de Datos');
		   </script>";
    
	
?>[/PHP]<style type="text/css">
<!--
body {
	background-color: #D3D0AF;
}
-->
</style></head>

<body>
</body>
</html> 

******NewId.pnp******
Esta pagina contiene un formulario en donde solicito el nuevo id y que se vuelva a digitar el nuevo id, para efectos de confirmacion

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
[PHP]<?php
require_once('conexion.php');
$id=$_GET["identificacion"];
$nId=$_POST["nuevoId"];
$cId= $_POST["confId"];
$tabla= 'cliente';
if($nId!= NULL || $cId != NULL)

{
  if($nId==$cId)
  {
  	 $resul=mysql_query("UPDATE $tabla SET identificacion='$nId' WHERE identificacion='$id'");
	 //$resul2=mysql_query("Update cliente Set identificacion='$nId' Where identificacion='$id'");
	 if ($resul )
	echo "<script languaje='javascript' type='text/javascript'>  
                  alert(\"Actualizacion exitosa\"); 
                  
          </script>"; 

  }
else
 echo "<script languaje='javascript' type='text/javascript'>  
                  alert(\"La identificacion y el numero de confirmacion no coinciden\"); 
                  
          </script>"; 
		  }
  
 

	
?>[/PHP]

<style type="text/css">
<!--
body {
	background-color: #D3D0AF;
}
-->
</style>

</head>

<body class="sub">
<form action="NewId.php" method="POST" name="form1"></form>
<table width="387" border="0" align="center" bgcolor="#D3D0AF">
  <tr>
    <td width="381"><label>Digite nuevo <br />
      numero
      de identificacion
      <input type="text" name="nuevoId" />
          <br />
          <br />
      Confirme Numero
      <input type="text" name="confId" />
      <br />
      </label>
    </td>
  </tr>
</table>
<p align="center">
  <input name="enviar" type="submit" id="enviar" value="Enviar" />
  <input name="cancelar" type="reset" id="cancelar" value="Cancelar" />
</p>

</body>
</html> 

MI GRAN PROBLEMA ES QUE AL EJECUTARLO ME VALIDA TODO Y HACE TODO APARENTEMENTE BIEN, ES DECIR REALIZA TODAS LAS VALIDACIONES, Y CUANDO VOY A ACTUALIZAR Y CUMPLE CON TODAS LAS NORMAS ME DICE QUE L AOPERACION FUE EXITOSA, PERO, SI MIRO EN LA TABLA DE MYSQL, EL REGISTRO SIGUE IGUAL!!!!!!

AYUDENME POR FAVOR, LO NECESITO CON MUCHA URGENCIA!!!!!!!!!!