Good afternoon
I'm trying to update data in the database and I can not. If I use mysqli, the following warning appears on the console: " link 500 (Internal Server Error)"
If I use connection with mysql and PDO, nothing happens, no warning in the console appears.
My js file:
app.controller("AtualizarUsuarioController", function ($scope, $window, $http, $location) {
$scope.usuario = {
'id': $window.localStorage.getItem('idUsuarios'),
'nome': $window.localStorage.getItem('nome'),
'email': $window.localStorage.getItem('email')
}
//$location.path('/atualizarUsuario' + $scope.usuario.id);
$scope.atualizarUsuario = function (usuario) {
$http.post("admin/php/atualizarUsuario.php", usuario).then(function (data){
$location.path("#/usuarios");
});
};
});
php:
<?php
header("Access-Control-Allow-Origin: *");
include_once ("conPDO.php");
$pdo = conectar();
$postdata = file_get_contents("php://input");
$data = json_decode($postdata);
$id = $data->id;
$nome = $data->nome;
$email = $data->email;
$senha = $data->senha;
$senha = sha1($senha);
$usuarioAtual=$pdo->prepare("UPDATE usuarios SET nome=:nome, email=:email, senha=:senha WHERE id=:id");
$usuarioAtual->bindValue(":nome", $nome);
$usuarioAtual->bindValue(":email", $email);
$usuarioAtual->bindValue(":senha", $senha);
$usuarioAtual->bindValue(":id", $id);
$usuarioAtual->execute();
Returnoftheconsoleafterprint_randconsole.log