PDO data insertion, does it work?

0

I am trying to create a registration page with the PDO however, it does not perform the insertion and does not present an error, what can it be?

include "../pages/sqlconn.php";

$name  = $_POST["name"];
$email = $_POST["email"];
$pass  = $_POST["password"];

try {
    $sql = "INSERT INTO db_user(user_name, user_email, user_pass) VALUES (?,?,?)";
    $ins = $conn->prepare($sql);
    $ins->bindParam(1, $name, PDO::PARAM_STR);
    $ins->bindParam(2, $email, PDO::PARAM_STR);
    $ins->bindParam(3, $pass, PDO::PARAM_STR);
    $ins->execute();
    echo $ins->execute();       
} catch (PDOException $e) {
    echo "ERROR: ".$e->getMessage();
}
    
asked by anonymous 29.05.2017 / 19:39

1 answer

-1

Try this:

include "../pages/sqlconn.php";

$name  = $_POST["name"];
$email = $_POST["email"];
$pass  = $_POST["password"];

try {
    $sql = "INSERT INTO db_user (user_name, user_email, user_pass) VALUES ('$name','$email','$pass')";
    $conn->query($sql)->fetchAll();       
} catch (PDOException $e) {
    echo "ERROR: ".$e->getMessage();
}
    
29.05.2017 / 20:19