Cita:
Iniciado por Erikfrancisco
Me parece que el código que te mande por ultima vez no funciona por estos detalles
![borracho](http://static.forosdelweb.com/fdwtheme/images/smilies/borracho.png)
:
$consulta .= " WHERE usuario = '".$_POST['usuario']."'";
$result = mysql_query ( $consulta );
$consulta3 = "SELECT * FROM clientes WHERE idcliente = '".$_POST['usuario']."'";
$result3 = mysql_query ( $consulta3 );
Hola amigo
Erikfrancisco.
Bueno modifique el codigo y ahora si se muestran los datos en ambos lados (antes de hacer UPDATE y despues).
Pero el problema es que no se modifican los datos entonces supongo que la parte del UPDATE esta mal o no se que pueda suceder.
Con respecto al campo con Unicidad, voy a hacer unico el campo de codVER (codigo de Vefiricación), pues el nombre de usuario yo creare con un numero aleatorio
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
.
Aqui te dejo la BD proyectodb.
http://www.fondoverde.org/jemano/usuario.sql
y aqui esta el codigo corregido pero como te comente no funciona el UPDATE:
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Estilo3 {color: #FF0000}
-->
</style>
</head>
<body>
<?php
@ $db = mysql_connect( 'localhost', 'root', '' ) or die ( "Unable to connect to MySQL server." );
$datos = mysql_select_db ( 'proyectodb', $db );
if ( isset ( $_POST['submit'] ) )
{
$consulta = "UPDATE usuario SET ";
$consulta .= "codver = '".$_POST['codver']."',";
$consulta .= "email = '".$_POST['email']."',";
$consulta .= "sexo = '".$_POST['sexo']."',";
$consulta .= "nombre = '".$_POST['nombre']."',";
$consulta .= "apepat = '".$_POST['apepat']."',";
$consulta .= "apemat = '".$_POST['apemat']."',";
$consulta .= "dni = '".$_POST['dni']."',";
$consulta .= "telefo = '".$_POST['telefo']."',";
$consulta .= "dire = '".$_POST['dire']."',";
$consulta .= "cuidad = '".$_POST['cuidad']."',";
$consulta .= "provin = '".$_POST['provin']."',";
$consulta .= "depa = '".$_POST['depa']."',";
$consulta .= "insti = '".$_POST['insti']."',";
$consulta .= "cargo = '".$_POST['cargo']."',";
$consulta .= "como = '".$_POST['como']."'";
$consulta .= " WHERE usuario = '".$_POST['usuario']."'";
$result = mysql_query ( $consulta );
$consulta3 = "SELECT * FROM usuario WHERE codver = '".$_POST['codver']."'";
$result3 = mysql_query ( $consulta3 );
$fila = mysql_fetch_array ( $result3 );
echo "El registro fue actualizado y ahora contiene los siguientes datos:<br/>";
echo "<input type = 'text' name = 'usuario' value = '".$fila['usuario']."'><br/>";
echo "<input type = 'text' name = 'codver' value = '".$fila['codver']."'><br/>";
echo "<input type = 'text' name = 'email' value = '".$fila['email']."'><br/>";
echo "<input type = 'text' name = 'sexo' value = '".$fila['sexo']."'><br/>";
echo "<input type = 'text' name = 'nombre' value = '".$fila['nombre']."'><br/>";
echo "<input type = 'text' name = 'apepat' value = '".$fila['apepat']."'><br/>";
echo "<input type = 'text' name = 'apemat' value = '".$fila['apemat']."'><br/>";
echo "<input type = 'text' name = 'dni' value = '".$fila['dni']."'><br/>";
echo "<input type = 'text' name = 'telefo' value = '".$fila['telefo']."'><br/>";
echo "<input type = 'text' name = 'dire' value = '".$fila['dire']."'><br/>";
echo "<input type = 'text' name = 'cuidad' value = '".$fila['cuidad']."'><br/>";
echo "<input type = 'text' name = 'provin' value = '".$fila['provin']."'><br/>";
echo "<input type = 'text' name = 'depa' value = '".$fila['depa']."'><br/>";
echo "<input type = 'text' name = 'insti' value = '".$fila['insti']."'><br/>";
echo "<input type = 'text' name = 'cargo' value = '".$fila['cargo']."'><br/>";
echo "<input type = 'text' name = 'como' value = '".$fila['como']."'>";
mysql_free_result ( $result3 );
}
else
{
$usuario = Admin;
$consulta2 = "SELECT * FROM usuario WHERE usuario = '".$usuario."'";
$result2 = mysql_query ( $consulta2, $db ) or die ( header ("No se pudo realizar la consulta" ) );
$fila2 = mysql_fetch_array ( $result2 );
?>
<form name = "formu" action = "<?php $_SERVER['PHP_SELFT']; ?>" method="post" >
<div align="center">
<table width="860" border="1">
<tr>
<td width="201">Cod Ver </td>
<td width="643"><input name="codver" type="text" readonly="true" value= "<?php echo $fila2['codver']; ?>"></td>
</tr>
<tr>
<td>Email</td>
<td><span class="Estilo3">
<input name="emaill" type="text" size="50" value= "<?php echo $fila2['email']; ?>"></span>
</td>
</tr>
<tr>
<td>Sexo</td>
<td><label>
<input name="sexo" type="radio" value = "hombre" <?php if ( $fila2['sexo'] == 'hombre' ) echo 'checked'?>>
Hombre</label>
<input name="sexo" type="radio" value = "mujer" <?php if ( $fila2['sexo'] == 'mujer' ) echo 'checked'?>>
Mujer</td>
</tr>
<tr>
<td>Nombres</td>
<td><span class="Estilo3">
<input name="nombre" type="text" id="nombre" readonly="true" size="50" value= "<?php echo $fila2['nombre']; ?>" >
</span></td>
</tr>
<tr>
<td>Apellido Parterno </td>
<td><span class="Estilo3">
<input name="apepat" type="text" readonly="true" size="35" value= "<?php echo $fila2['apepat']; ?>">
</span></td>
</tr>
<tr>
<td>Apellido Materno </td>
<td><span class="Estilo3">
<input name="apemat" type="text" readonly="true" size="35" value = "<?php echo $fila2['apemat']; ?>">
</span></td>
</tr>
<tr>
<td>DNI</td>
<td><span class="Estilo3">
<input name="dni" type="text" size="8" value= "<?php echo $fila2['dni']; ?>">
</span></td>
</tr>
<tr>
<td>Telefonos:</td>
<td><span class="Estilo3">
<input name="telefo" type="text" id="telefono" size="35" value = "<?php echo $fila2['telefo']; ?>">
</span></td>
</tr>
<tr>
<td>Direccion</td>
<td><span class="Estilo3">
<input name="dire" type="text" id="direccion" size="50" value = "<?php echo $fila2['dire']; ?>">
</span></td>
</tr>
<tr>
<td>Cuidad</td>
<td><span class="Estilo3">
<input name="cuidad" type="text" size="30" value = "<?php echo $fila2['cuidad']; ?>">
</span></td>
</tr>
<tr>
<td>Provincia</td>
<td><span class="Estilo3">
<input name="provin" type="text" id="provincia" size="30" value = "<?php echo $fila2['provin']; ?>">
</span></td>
</tr>
<tr>
<td>Departamento:</td>
<td><span class="Estilo3">
<input name="depa" type="text" id="departamento" size="30" value = "<?php echo $fila2['depa']; ?>">
</span></td>
</tr>
<tr>
<td colspan="2">De la instiucion</td>
</tr>
<tr>
<td>Instituxcion Proveniente </td>
<td><span class="Estilo3">
<input name="insti" type="text" id="institucion" size="50" value = "<?php echo $fila2['insti']; ?>">
</span></td>
</tr>
<tr>
<td>Cargo</td>
<td><span class="Estilo3">
<input name="cargo" type="text" id="cargo" size="50" value = "<?php echo $fila2['cargo']; ?>">
</span></td>
</tr>
<tr>
<td>Otro</td>
<td> </td>
</tr>
<tr>
<td>Como se entero </td>
<td><span class="Estilo3">
<input name="como" type="text" id="como" size="50" value = "<?php echo $fila2['como']; ?>">
</span></td>
</tr>
<tr>
<td><input type = "submit" name = "submit" value = "Actualizar"></td>
</tr>
</table>
</div>
</form>
<?php
mysql_free_result ( $result2 );
}
?>