Skip Headers
Oracle® Database 2 Day + PHP Developer's Guide
11g Release 2 (11.2)

Part Number E10811-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

1 Introducing PHP with Oracle Database

PHP is a popular scripting language that can be embedded in HTML, which makes it particularly useful for Web development.

This chapter has the following topics:

Purpose

This document is a tutorial that shows you how to use PHP to connect to Oracle Database, and demonstrates how to use PHP to access and modify data.

Overview of the Sample Application

This document guides you through the development of a sample Human Resources (HR) application for a fictitious company called AnyCo Corp. For this introduction to the PHP language no framework or abstraction layer is used. However, PHP frameworks are becoming popular and they should be evaluated when building any large application.

The application manages departmental and employee data stored in the DEPARTMENTS and EMPLOYEES tables in the HR schema provided with Oracle Database. See Oracle Database Sample Schemas for information about this schema.

The complete sample application:

Figure 1-1 shows the relationship among the files developed for this application.

Figure 1-1 Components of the Sample HR Application

Description of Figure 1-1 follows
Description of "Figure 1-1 Components of the Sample HR Application"

The sample application files are:

anyco.php This file contains the main logic for the AnyCo application. It contains control logic that determines which page is displayed. It manages session data for navigation. It calls functions in the include files anyco_cn.inc, anyco_db.inc, and anyco_ui.inc.
anyco_ui.inc This file contains the functions used to present data and forms in an HTML page.
anyco_cn.inc This file contains definitions for database connection information, the database user name, password, and database connection identifier.
anyco_db.inc This file contains the database logic to create database connections, execute queries, and execute data manipulation statements.
anyco_im.php This file contains logic to retrieve an image from a database column and send it to a Web browser for display as a JPEG image.
style.css This file contains Cascading Style Sheet (CSS) definitions for various HTML tags generated by the application. It manages the look and feel of the application.

Files with the suffix .inc are PHP code files included in other PHP files.

Files with the suffix .php can be loaded in a Web browser.

You can create and edit the PHP application source files in a text editor or any tool that supports PHP development.

The code for each chapter builds on the files completed in the previous chapter.

Resources

The following Oracle Technology Network Web sites provide additional information you may find useful.