-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype-demo.php
More file actions
52 lines (41 loc) · 1.05 KB
/
Copy pathtype-demo.php
File metadata and controls
52 lines (41 loc) · 1.05 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
43
44
45
46
47
48
49
50
51
52
<?php
class User{
public int $id;
public string $name;
public function __construct(){
# connect to database;
}
public function addUser(int $id, string $name){
$this->id = $id;
$this->name = $name;
#connect to DB
#insert id and name in user table
}
public function showUser(int $userid){
#$this->id = $id;
echo "id is ".$this->id." Name is ".$this->name;
# connect to DB
# write some sql Queries and get the record
#return $data;
}
public function deleteUser(int $userid){
# 1. check data from table user for $userid
# 2. delete that data
return 1;
}
public function updateUser(int $userid){
}
}
// $userid = $_POST['userid'];
// $username = $_POST['username'];
$user1 = new User();
$user1->addUser(1000, 'Jay');
$user1->showUser(1000);
$response = $user1->deleteUser(1000);
if($response==1){
echo "record successfully deleted";
}
$user1->updateUser(1000);
// echo $user1->id;
// echo $user1->name;
?>