function getRetailPrice($itemNo) { $select_stmt = "SELECT FullRetailPrice FROM Item WHERE ItemNumber = '{$itemNo}'"; $not_found_message = "Could not retrieve Full Retail Price from Item."; $result = get_unique_row($select_stmt, $not_found_message, $not_found_message); return $result['FullRetailPrice']; }
function getAmountOff($pCode) { $select_stmt = "SELECT AmountOff FROM Promotion WHERE PromoCode = {$pCode}"; $not_found_message = "Could not retrieve Amount Off from Promotion."; $result = get_unique_row($select_stmt, $not_found_message, $not_found_message); return $result['AmountOff']; }
function getPromotion() { connect_and_select_db(DB_SERVER, DB_UN, DB_PWD, DB_NAME); $promoCode = $_REQUEST['promoCode']; $sql = "SELECT PromoCode, Name, Description, AmountOff, PromoType\n FROM Promotion\n WHERE PromoCode = '" . $promoCode . "'"; $error_message = "Could not successfully run query to get promotion data ({$sql}) from DB: "; $not_found_message = "Promotion with PromoCode ({$promoCode}) not found in DB"; $row = get_unique_row($sql, $error_message, $not_found_message); $promoCode = $row["PromoCode"]; $name = $row["Name"]; $description = $row["Description"]; $amountOff = $row["AmountOff"]; $promoType = $row["PromoType"]; ui_show_update_promotion_form($promoCode, $name, $description, $amountOff, $promoType); }
function getItem() { connect_and_select_db(DB_SERVER, DB_UN, DB_PWD, DB_NAME); $itemNumber = $_REQUEST['itemNumber']; $sql = "SELECT ItemNumber, ItemDescription, Category, DepartmentName, PurchaseCost, FullRetailPrice\n FROM Item\n WHERE ItemNumber = '" . $itemNumber . "'"; $error_message = "Could not successfully run query to get item data ({$sql}) from DB: "; $not_found_message = "Item with Item Number ({$itemNumber}) not found in DB"; $row = get_unique_row($sql, $error_message, $not_found_message); $itemNumber = $row["ItemNumber"]; $itemDescription = $row["ItemDescription"]; $category = $row["Category"]; $deptName = $row["DepartmentName"]; $purchCost = $row["PurchaseCost"]; $retail = $row["FullRetailPrice"]; ui_show_update_item_form($itemNumber, $itemDescription, $category, $deptName, $purchCost, $retail); }
function getEvent() { connect_and_select_db(DB_SERVER, DB_UN, DB_PWD, DB_NAME); $eventCode = $_REQUEST['eventCode']; $sql = "SELECT EventCode, AdEvent.Name, StartDate, EndDate, Description, AdType\n FROM AdEvent\n WHERE EventCode = '" . $eventCode . "'"; $error_message = "Could not successfully run query to get event data ({$sql}) from DB: "; $not_found_message = "Event with Event Code ({$eventCode}) not found in DB"; $row = get_unique_row($sql, $error_message, $not_found_message); $eventCode = $row["EventCode"]; $name = $row["Name"]; $startDate = $row["StartDate"]; $endDate = $row["EndDate"]; $description = $row["Description"]; $adType = $row["AdType"]; ui_show_update_event_form($eventCode, $name, $startDate, $endDate, $description, $adType); }