示例#1
0
 function truncate()
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("TRUNCATE TABLE free_delivery_price");
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
示例#2
0
 function getUnusedCreditListByReceiverId($receiver_id)
 {
     $creditList = [];
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("SELECT sender_id, receiver_id FROM credit_history WHERE receiver_id = ? AND status = false");
     $stmt->bind_param("s", $receiver_id);
     $stmt->execute();
     $stmt->bind_result($sender_id, $receiver_id);
     while ($stmt->fetch()) {
         $credit = [];
         $credit["sender_id"] = $sender_id;
         $credit["receiver_id"] = $receiver_id;
         array_push($creditList, $credit);
     }
     $ConnectionManager->closeConnection($stmt, $conn);
     return $creditList;
 }
示例#3
0
 function updateSpecificPhoto($project_id, $photo_no, $new_url)
 {
     $url = self::getSpecificPhotoURL($project_id, $photo_no);
     unlink($url);
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE photo SET photo_url=? WHERE project_id=? AND photo_no=?");
     $stmt->bind_param("sss", $new_url, $project_id, $photo_no);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
示例#4
0
 function setGift($code, $product_name, $worth, $photo)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE reward SET product_name = ? , worth = ? , photo = ? WHERE code = ?");
     $stmt->bind_param("ssss", $product_name, $worth, $photo, $code);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
示例#5
0
 function deleteProject($project_id)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("DELETE FROM project WHERE project_id = ?");
     $stmt->bind_param("s", $project_id);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
示例#6
0
 function deleteAllPhotosByProduct($product_id)
 {
     $photoList = self::getPhotos($product_id);
     foreach ($photoList as $url) {
         unlink($url);
     }
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("DELETE FROM photo WHERE product_id = ?");
     $stmt->bind_param("s", $product_id);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
示例#7
0
 function getPostalCode($customer_id, $address_no)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("SELECT postal_code FROM address WHERE customer_id=? AND address_no=?");
     $stmt->bind_param("si", $customer_id, $address_no);
     $stmt->execute();
     $stmt->bind_result($postal_code);
     $postalcode = '';
     while ($stmt->fetch()) {
         $postalcode = $postal_code;
     }
     $ConnectionManager->closeConnection($stmt, $conn);
     return $postalcode;
 }
示例#8
0
 function updateColorInOptionalCodeTable($product_id, $new_color, $old_color)
 {
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE optional_code SET color = ? WHERE product_id = ? AND color = ?");
     $stmt->bind_param("sss", $new_color, $product_id, $old_color);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }
示例#9
0
 function checkProductPendingOrderStatus($product_id)
 {
     $result = 0;
     $ConnectionMgr = new ConnectionManager();
     $conn = $ConnectionMgr->getConnection();
     $stmt = $conn->prepare("SELECT COUNT(*) AS count FROM `order` where `product_id` = ? AND `status` = 'pending'");
     $stmt->bind_param("s", $product_id);
     $stmt->execute();
     $stmt->bind_result($count);
     while ($stmt->fetch()) {
         $result = $count;
     }
     $ConnectionMgr->closeConnection($stmt, $conn);
     return $result;
 }
示例#10
0
 function activateAccount($customer_id)
 {
     $verified = "true";
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("UPDATE customer SET verified=? WHERE customer_id = ?");
     $stmt->bind_param("ss", $verified, $customer_id);
     $stmt->execute();
     $ConnectionManager->closeConnection($stmt, $conn);
 }