-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteste.php
More file actions
28 lines (23 loc) · 880 Bytes
/
teste.php
File metadata and controls
28 lines (23 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
include_once "conexao.php";
// $atualiza = [
// 'id' => 1,
// 'nome' => 'teste',
// 'email' => 'teste@gamil.com'
// ];
// $update = $con->prepare("UPDATE usuario SET nome = :nome, email = :email WHERE id_usuario = :id");
// if($update->execute($atualiza)) {
// echo json_encode(['Mensagem' => "[SUCESSO] Atualizado com sucesso!"]);
// } else {
// echo json_encode(['Mensagem' => "[ERRO] Erro ao atualizar!"]);
// }
$novo = [
'nome' => 'Guh',
'email' => 'gus@teste.com'
];
$insert = $con->prepare('INSERT INTO usuario (nome, email) VALUES (:nome, :email)');
if($insert->execute($novo)) {
echo json_encode(['Mensagem' => "[SUCESSO] Cadastrado com sucesso!"]);
} else {
echo json_encode(['Mensagem' => "[ERRO] Não fopossível cadastrar!"]);
}