-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.php
44 lines (39 loc) · 1.07 KB
/
library.php
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
43
44
<?php
class generalActs
{
function createShortList($pdo)
{
$stmt = $pdo->prepare('SELECT id, name, photo, email, sex FROM patients');
$stmt->execute();
return $stmt;
}
function connect()
{
$pdo = new PDO('mysql:host=localhost;dbname=scrubs', 'root', '');
$pdo->setAttribute(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
);
return $pdo;
}
function adding($pdo)
{
$add = $pdo->prepare('INSERT INTO patients (name, email, sex, insurance_num, card_num, history ) VALUES(:name, :email, :sex, :insurance_num, :card_num, :history )');
$add->execute(array(':name' => $_POST['name'],
':email' => $_POST['email'],
':sex' => $_POST['sex'],
':insurance_num' => $_POST['insurance_num'],
':card_num' => $_POST['card_num'],
':history' => $_POST['history']
));
return $add;
}
function remove($pdo, $id)
{
$remove = $pdo->prepare('DELETE FROM patients WHERE id = :id');
$remove->bindParam(':id', $id);
$remove->execute();
return $remove;
}
}
?>