the PDO record is not updated

0

hi friends of the community I have a problem I'm doing UPDATE but the problem is that I jump for the alert once and I do not update the record the me you receive the parameters well the only problem is when performing the UPDATE append the code to see what I'm doing wrong.

<?php
if(isset($_GET['actualizar'])){
$sql=$DB_con->prepare("UPDATE usuarios SET cedula=:cedula, nombres=:nombres, apellidos=:apellidos,    email=:email WHERE id = :id");


$sql->bindParam(':cedula',$_GET['cedula']);
$sql->bindParam(':nombres',$_GET['nombres']);
$sql->bindParam(':apellidos',$_GET['apellidos']);
$sql->bindParam(':email',$_GET['email']);
$sql->bindParam(':id',$_GET['id']);
$sql->execute();
if($sql)
{
echo "<div class='col s12 card-panel teal lighten-2 center'>
<h5 class='black-text text-darken-2 center CONDENSED LIGHT5'>
¡ Bien Hecho: Registro actualizado Correctamente !
</h5>
</div>";
header("refresh:5;index.php");
}
else
{
echo "<div class='col s12 card-panel blue lighten-2 center'>
<h5 class='black-text text-darken-2 center CONDENSED LIGHT5'>
¡ Ups Aviso: El Registro no se pudo actualizar ! 
</h5>
</div>";
header("refresh:5;index.php");
}
}
?>
    
asked by yoclens 08.12.2016 в 02:53
source

1 answer

0

I can not believe what the error was:

It turns out that my file is called update and the value of the input is name="actualizar" in if(isset($_GET['actualizar'])) , so every time the page entered it was updated I have edited it alone to

if(isset($_GET['edita']))
name="edita"

and it works wonders jejeejej tremendous lio

    
answered by 08.12.2016 в 04:58