-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTranscations.php
84 lines (63 loc) · 2.06 KB
/
Transcations.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
class Transcations{
var $transcationID;
var $bookID;
var $stdID;
var $issueDate;
var $dueDate;
var $returnDate;
var $Description;
var $servername = "localhost";
var $username = "root";
var $password = "";
var $dbname = "libraryManagement";
var $conn1 = "";
function setTranscationID($transcationID){
$this->transcationID = $transcationID;
}
function setStdId($stdID){
$this->stdID = $stdID;
}
function setbookID($bookID){
$this->bookID = $bookID;
}
function setissueDate($issueDate){
$this->issueDate = $issueDate;
}
function setdueDate($dueDate){
$this->dueDate = $dueDate;
}
function setreturnDate($returnDate){
$this->returnDate = $returnDate;
}
function setDescription($Description){
$this->Description = $Description;
}
function insertTranscation(){
$conn = mysqli_connect($this->servername, $this->username, $this->password, $this->dbname);
mysql_select_db($this->dbname);
$sql = "INSERT INTO Transcation (bookID, stdid, issueDate, dueDate, returnDate, Description)
VALUES ('$this->bookID', '$this->stdID','$this->issueDate','$this->dueDate','$this->returnDate','$this->Description')";
if ($conn->query($sql) === TRUE) {
//echo "New record created successfully";
} else {
//echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
function updateTranscationReturnDate($id,$returnDate){
$conn = mysqli_connect($this->servername, $this->username, $this->password, $this->dbname);
mysql_select_db($this->dbname);
$sql = "UPDATE Transcation SET
returnDate = '$returnDate'
where transcationId = $id
";
if ($conn->query($sql) === TRUE) {
//echo "New record created successfully";
} else {
//echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
}
?>