7. Execute the following code, which creates the customer_get_shipping_regions stored procedure in
your tshirtshop database:
-- Create customer_get_shipping_regions stored procedure
CREATE PROCEDURE customer_get_shipping_regions()
BEGIN
SELECT shipping_region_id, shipping_region FROM shipping_region;
END$$
The customer_get_shipping_regions stored procedure returns the shipping regions in the database
for the customer address details page.
8. Execute this code, which creates the customer_update_address stored procedure in your tshirtshop
database:
-- Create customer_update_address stored procedure
CREATE PROCEDURE customer_update_address(IN inCustomerId INT,
IN inAddress1 VARCHAR(100), IN inAddress2 VARCHAR(100),
IN inCity VARCHAR(100), IN inRegion VARCHAR(100),
IN inPostalCode VARCHAR(100), IN inCountry VARCHAR(100),
IN inShippingRegionId INT)
BEGIN
UPDATE customer
SET address_1 = inAddress1, address_2 = inAddress2, city = inCity,
region = inRegion, postal_code = inPostalCode,
country = inCountry, shipping_region_id = inShippingRegionId
WHERE customer_id = inCustomerId;
END$$
The customer_update_address stored procedure updates the customer??™s address in the database.
CHAPTER 16 ?– MANAGING CUSTOMER DETAILS 504
Implementing the Business Tier
In the business folder, create a new file named customer.php that will contain the Customer
class.
Pages:
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626