![]() |
|
Workshop: Using PHP/mySQL With PHP/mySQL you don't need an Oracle license or DBA to get your e-business back end up to speed. September 24, 2000 IntroductionUnder the hood of any e-commerce site is code implementing the logic of the business and some sort of data store for tracking products, orders and customers. Developers are faced with many options for this code. Microsoft , Sun Microsystems and other vendors provide tried-and-true platforms, with Java, Basic and C/C++ development packages and proprietary software architectures. Oracle, Informix and MS SQL are among the more popular database engines. All are flexible, powerful and reliable solutions backed by industry leaders. But such attributes often come at a steep cost.As the open-source movement gained momentum in the last decade, pushed and pulled by the momentum of the Internet, an impressive number of mature, commercial-grade software products were produced by loose communities of developers scattered around the world. Today, a server suitable to host a typical e-commerce Web site, including an operating system, Web server software, SQL database server software and a development system can be built for what was once the cost of the hardware alone. The Linux, Apache and PERL projects have long been prime examples of reliable, open-source software, and are mainstays of Web application development and deployment. Rising stars in this field are the PHP script language and mySQL database engine. In this article we'll explore using the PHP and mySQL in an e-commerce setting. PHPPHP is an HTML embedded server-side scripting language, such as Microsoft's Active Server Pages (ASP) or Allaire's Cold Fusion. "HTML embedded" means that the code is inserted directly into the HTML document (between special tags) and is interpreted by the server on the fly each time the page is requested. PHP's syntax borrows heavily from C and PERL, making the transition to PHP comfortable for those that have developed CGI applications in those languages.Aside from the variable manipulation, flow control and function constructs expected in a general purpose programming language, PHP is tuned for Web development with automatic conversion of form variables to PHP variables and built-in functions to handle cookies and session management. Many third-party modules have been written to seamlessly integrate with PHP to extend its functionality. Modules are available that allow the developer to access other Internet services (such as e-mail), the local OS and several database packages.. PHP is distributed under its own license and is less restrictive than GNU General Public License (GPL). Commercial entities may use, modify and contribute to the code free of charge. Under certain circumstances, such as redistribution, credit to the PHP development team must be given. mySQLTo quote the documentation, "mySQL is a very fast, multithreaded, multiuser SQL database server." Interest in mySQL has increased over the past few years along with Linux, Apache and other headliners of the open-source movement. mySQL has gained a reputation as a very reliable, affordable alternative to it's much-hyped commercial counterparts. Features that have helped mySQL gain its stellar reputation are:
From a portability standpoint, mySQL is almost entirely ANSI SQL92-compliant. The server may be run in ANSI mode, guaranteeing queries will be parsed according to the standard. In addition, mySQL offers extensions to the standard syntax and data types. Handy syntax extensions, such as REPLACE and SHOW statements, are available. REPLACE behaves like an INSERT statement. However, if the key value of the new record matches the key value of an existing record on a unique index, the existing record is deleted before the new one is inserted‹saving an explicit DELETE statement. The SHOW statement retrieves information about databases, tables, columns and status information about the server itself. AUTO_INCREMENT may be specified as an integer column type attribute that will cause the server to assign the field the next sequence number on each insert automatically. We¹ll be using the AUTO_INCREMENT column type attribute in our example to assign a unique ID to our products and orders. See section 5 of the official mySQL documentation for a brief summary of the differences between mySQL's implementation and the ANSI standard. One of mySQL's main design goals is speed. Features not included in mySQL typically are not there for a good reason: They compromise performance. MySQL is under constant development and new features are always being added based on customer demand and efficient solutions. Missing features include subselects, selecting directly into a table, stored procedures, triggers, foreign keys and views. A list of missing features can also be found in Section 5 of the mySQL official documentation. Originally, mySQL source and binary distributions were available free of charge to develop with, but a nominal fee was required if the server was used for commercial purposes. In June 2000, with new financial backing, mySQL went fully GPL and is available at no charge to deploy in most settings. A paid license is typically required if the mySQL server (or a modified version of it) is distributed with an application. Using mySQL as the back-end database on a unique purpose Web server does not require a license fee. The No. 1 reason that open-source solutions fail to make it off the drawing board in larger corporations is lack of support. Corporations have formed around many of the most popular open-source projects that offer support for a fee, and many have excellent documentation and active online communities from which to get answers. Customers that rely on mySQL to run their businesses are encouraged to purchase e-mail support or login support. With e-mail support, answers to your questions and requests may be obtained directly from the mySQL development team via e-mail. Login support includes e-mail support, a mySQL representative may login to the problem system and attempt to solve specificissues, and moderate phone support from a mySQL developer. "Extended" login and phone support options are also available. Page 1 | 2 | 3 | 4 | 5 | Next page Send your comments on this article to Patrick A. Paskvan at paskvan@data.assist.com. | |












