Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/12/2017, 06:19
Parliament
 
Fecha de Ingreso: noviembre-2003
Mensajes: 499
Antigüedad: 20 años, 5 meses
Puntos: 7
Respuesta: llenar campos de texto

Hola amigos hice este grupo de programas y ne da el error de que no encuentra el registro y no entiendo por que, en este formulario ingreso el registro a buscar

Código PHP:
<!doctype html>
<
html>
<
head>
  <
title>Modificación</title>
</
head>
<
body>
  <
form method="post"  action="pagina2.php">
    
Ingrese el código de artículo a modificar:
    <
input type="text" name="nresol" size="10" required>
    <
br>
    <
input type="submit" value="Consultar">
  </
form>
</
body>
</
html
Este me muestra el registro donde veo las datos a modificar
Código PHP:
<head>
  <title>Modificación</title>
</head>  
<body>
  
  <?php
    $mysql
=new mysqli("localhost","root","","tural");
    if (
$mysql->connect_error)
      die(
"Problemas con la conexión a la base de datos");
  
    
$registro=$mysql->query("select * from prestad where N_Resol = $_REQUEST[nresol]") or
      die(
$mysql->error);
     
    if (
$reg=$registro->fetch_array())
    {
  
?>
    <form method="post" action="pagina3.php">
      Nombre y Apellido:
      <input type="text" name="Nyap" size="50" value="<?php echo $reg['Nyap']; ?>"/>
      <br>
      Codigo de Actividad:
      <input type="text" name="Cod_act" size="50" value="<?php echo $reg['Cod_act']; ?>"/>
      <br>
      Codigo de Area:
      <input type="text" name="Cod_area" size="50" value="<?php echo $reg['Cod_area']; ?>"/>
      <br>
      Nombre de Fant:
      <input type="text" name="Nombre_fant" size="50" value="<?php echo $reg['Nombre_fant']; ?>"/>
      <br>
      Telefono:
      <input type="text" name="Telefono" size="10" value="<?php echo $reg['Telefono']; ?>"/>      
      <br>    
      Mail:
      <input type="text" name="Mail" size="50" value="<?php echo $reg['Mail']; ?>"/>
      <br>      
      <input type="hidden" name="nresol" value="<?php echo $reg['N_Resol']; ?>"/>     
      <br> 
      <input type="submit" value="Confirmar">
    </form>
  <?php
    
}      
    else
      echo 
'No existe este prestador';
    
    
$mysql->close();

  
?>  
</body>
este hace la modificacion

Código PHP:
<!doctype html>
<html>
<head>
  <title>Modificación</title>
</head>  
<body>
  
  <?php
    $mysql
=new mysqli("localhost","root","","tural");
    if (
$mysql->connect_error)
      die(
"Problemas con la conexión a la base de datos");
  
    
$mysql->query("update prestad set 
                           Nyap='$_REQUEST[Nyap]',
                          Cod_act =$_REQUEST[Cod_act],
                           Cod_area=$_REQUEST[Cod_area],
                           Nombre_fant=$_REQUEST[Nombre_fant],
                           Telefono=$_REQUEST[Telefono],
                           Mail=$_REQUESTMail]
              where N_Resol=$_REQUEST[N_Resol]"
) or
      die(
$mysql->error);
     
    echo 
'Se modificaron los datos del artículo';
    
    
$mysql->close();

  
?>  
</body>
</html>