You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: db/database.php
+39
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,45 @@ public function __construct($servername, $username, $password, $dbname, $port){
10
10
}
11
11
}
12
12
13
+
/**
14
+
* Only orders with at least one final product from a seller are displayed.
15
+
*/
16
+
publicfunctiongetOrdersBySeller($order_id) {
17
+
$stmt = $this->db->prepare("SELECT DISTINCT(prints_order.Order_id), Ship_city, Ship_postal_code, Ship_address, Order_date, Shipped_date, prints_order.Email, Card_number, prints_order.Shipper_name, Status FROM `prints_order`, `final_product`, `art_print`, `picture`, user WHERE prints_order.Order_id = final_product.Order_id AND `final_product`.`Picture_title` = `art_print`.`Picture_title` AND art_print.Picture_title = picture.Title AND picture.Email = user.Email AND user.Email=?");
$stmt = $this->db->prepare("SELECT SUM(final_product.Price) as Total_amount FROM `prints_order`, `final_product` WHERE prints_order.Order_id = final_product.Order_id AND prints_order.Order_id=?");
27
+
$stmt->bind_param("i", $order_id);
28
+
$stmt->execute();
29
+
$result = $stmt->get_result();
30
+
31
+
return$result->fetch_all(MYSQLI_ASSOC);
32
+
}
33
+
34
+
publicfunctiongetNumberPrintsOrdered($order_id) {
35
+
$stmt = $this->db->prepare("SELECT COUNT(*) as Number_prints_ordered FROM `prints_order`, `final_product` WHERE prints_order.Order_id = final_product.Order_id AND prints_order.Order_id=?");
36
+
$stmt->bind_param("i", $order_id);
37
+
$stmt->execute();
38
+
$result = $stmt->get_result();
39
+
40
+
return$result->fetch_all(MYSQLI_ASSOC);
41
+
}
42
+
43
+
publicfunctiongetOrderById($order_id) {
44
+
$stmt = $this->db->prepare("SELECT * FROM prints_order WHERE Order_id=?");
45
+
$stmt->bind_param("i", $order_id);
46
+
$stmt->execute();
47
+
$result = $stmt->get_result();
48
+
49
+
return$result->fetch_all(MYSQLI_ASSOC);
50
+
}
51
+
13
52
publicfunctioncheckLogin($email, $password){
14
53
/* I check if there is a user with specified email */
15
54
$stmt = $this->db->prepare("SELECT Email, Role, Password, Salt FROM user WHERE Email = ?");
0 commit comments