-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditarPaciente.php
More file actions
42 lines (30 loc) · 1.09 KB
/
editarPaciente.php
File metadata and controls
42 lines (30 loc) · 1.09 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
session_start();
if (!isset($_SESSION['usuario'])) {
Header("Location: index.html");
}
$conexao = mysql_connect("localhost","root",""); //abre a conexao com banco
if(!$conexao){
echo "Erro ao se conectar ao banco";
exit;
}
$banco = mysql_select_db("hospital"); // seleciona o banco a ser usado
if(!$banco){
echo "Erro ao se conectar com o banco trabalho";
exit;
}
$id = trim($_POST['id']);
$nome = trim($_POST['txtNome']);
$cpf = trim($_POST['txtCPF']);
$sus = trim($_POST['txtSUS']);
$telefone = trim($_POST['txtTelefone']);
$endereco = trim($_POST['txtEndereco']);
$obs = trim($_POST['txtObservacao']);
$sql = "UPDATE pacientes set nomePaciente='$nome',cpf='$cpf',sus='$sus',telefone='$telefone',endereco='$endereco', observacao='$obs' where id='$id';";
$ins = mysql_query($sql); // comando para inserir no banco
if(!ins){
echo "Deu erro ao atualizar o produto";
}
else { echo "campo descricao em branco"; }
header("location:manterPacientes.php");
?>