Prev | Current Page 681 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


You can learn more about the support for interfaces in PHP at http://php.net/interfaces.
We??™ll create a single pipeline section, PsDummy, which uses some of this functionality.
PsDummy is used in the code of this chapter in place of the real pipeline section classes, which
we??™ll implement in the next chapter.
Exercise: Implementing the Skeleton of the Order-Processing Functionality
1. Using phpMyAdmin, select the tshirtshop database, and open a new SQL query page.
2. Execute this code, which creates the audit table in the tshirtshop database:
-- Create audit table
CREATE TABLE `audit` (
`audit_id` INT NOT NULL AUTO_INCREMENT,
`order_id` INT NOT NULL,
`created_on` DATETIME NOT NULL,
`message` TEXT NOT NULL,
`code` INT NOT NULL,
PRIMARY KEY (`audit_id`),
KEY `idx_audit_order_id` (`order_id`)
);
CHAPTER 18 ?–  IMPLEMENTING THE ORDER PIPELINE: PART 1 575
3. Execute the following code, which creates the orders_create_audit stored procedure in the
tshirtshop database (don??™t forget to set the delimiter to $$):
-- Create orders_create_audit stored procedure
CREATE PROCEDURE orders_create_audit(IN inOrderId INT,
IN inMessage TEXT, IN inCode INT)
BEGIN
INSERT INTO audit (order_id, created_on, message, code)
VALUES (inOrderId, NOW(), inMessage, inCode);
END$$
4. Moving to the business tier, add the following method to the Orders class in business/orders.


Pages:
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693