Mysql UPDATE is not performed

0

I have a file in HTML and PHP in charge of updating the information in the database. I have consulted other questions similar to this one and I can not find the detail. This is the code that the update should perform:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <link rel="shortcut icon" href="favicon.png" type="image/x-icon"/>
 <link rel="icon" type="image/png" href="favicon.png" />
 <title>Registro</title>    
 </head>

 <body>
  <div>

  <?php
  $id=$_GET['id']; 

  $mysqli = NEW MySQLi('localhost','usuario','password','basedatos');

  $queryb=mysqli_query($mysqli,"select * from users where id='$id'");

  $result=mysqli_fetch_array($queryb);

                   if(isset($_POST['submit'])){
                        $username=    $_POST['username'];
                        $name= $_POST['name'];
                        $pass=          $_POST['pass'];



                        $queryc= "update users set username='$username', name='$name', pass='$pass' WHERE id='$id'";

                        $insert = $mysqli->query($queryc);

                        if($insert){
                            header('Location: regexitoso.php');

                        }else{
                            echo "La consulta no se realizó";
                        }

                    $mysqli->close();   

  }
  ?>
            </div>
            <div>
            <h1>Modificar información de <?php echo $result['name']; ?></h1>

            <form action="" method="post" name="registro" id="formulario"><br><br>
                <table>
                    <tr><td>Usuario: <input type="text" name="username" id="username" value="<?php echo "$result[username]"?>"></td> 
                    </tr>
                    <tr><td>Nombre:<input type="text" name="name" id="name" value="<?php echo "$result[name]"?>" ></td> 
                    </tr>
                    <tr><td>Contraseña: <input type="password" name="pass" value="<?php echo "$result[pass]"?>"></td> 
                    </tr>
                    <tr><td> <input name="submit" id="submit" type="submit" value="Actualizar" /></td></tr>
                </table><br><br>
            </form>
            </div>

    </body>
</html>

Looking at the error_log file does not throw me any errors, the query simply does not happen.

    
asked by He_slp13 22.01.2018 в 20:16
source

0 answers