# Air Alliance

## NetBeans PHP Sample Application

# Air Alliance Sample Application - Readme

## NetBeans PHP Sample Application

Author: Frank Jennings

## What is AirAlliance?

AirAlliance is an imaginary airlines company that lets you book tickets through their web site. This PHP application is created to highlight PHP features supported by NetBeans IDE.

## This sample demonstrates the following features:

- Session Management
- DB Interaction
- OOP Concepts

## Requirements

Follow these before you run the sample:

- Install NetBeans 6.1 IDE with PHP support
- Install and configure PHP Runtime
- Install and configure MySQL database

## What is included?

- NetBeans `PHP Application` Project
- Database SQL Script - Use this script to populate tables and sample records
- Additional Stylesheet

## Before the start

- If you want to try the sample out, follow Getting Started guidelines.
- In case of you want to try debugging features of the NetBeans IDE, follow the Debugging guidelines.

## Getting Started

1. Firstly, we set database authentication in `conf/conf.php`, which is stored in Air Alliance Project directory.
   Just update login and password fields in the configuration file, so they are the same as MySQL ones.
2. Secondly, we create the database and populate it with data:
   1. Create new MySQL database named `AirAlliance` in phpMyAdmin.
   2. Run `sql/aadb_dump.sql` script stored in Air Alliance Project directory. The script creates tables and fills them with sample data.
3. Then we set project preperties to deploy project sucessfully to PHP document directory:
   1. Right-click on the `AirAlliance` project node and select `Properties`.
   2. Check the option `Copy files from Sources Folder to another location`.
   3. In `Copy to Folder` field specify the path of your PHP documents directory (htdocs).
   4. Specify the `Project URL` to be appropriate with your settings from previous field and also with PHP Server setup.
   5. Confirm the settings.
4. Finally, we can run the project. Right-click the project node again and select `Run Project`. The sample PHP application should open in the Web brower.
5. Click View Itinerary link in the right pane. You should see some records shown from the database.
6. Play futher with the sample:)

## Debugging

There steps should enable you the debugging option at the sample project, if you already have PHP debugger installed and configured.
For demonstrating the PHP debugger in NetBeans we have to put the sample project to the PHP documents directory (htdocs):
1. Create new `Air Alliance Sample Application` with following settings:
2. Set the Project Folder to your PHP documents (htdocs) directory, for example: `...\Apache2.2\htdocs\AirAlliance\`
3. In project properies (Right-click the project node and select `Properties`.) set the `Project URL` to be appropriate with previous setting, for example: `http://localhost/AirAlliance/web/`
4. To debug, right-click the project node and select `Debug Project`.

## Project folder's structure

- classes - Contains some helper classes highlighting Object Oriented Programming.
- conf - Contains the PHP file (Conf.php) from where you can edit the DB Connection settings.
- css -Contains the stylesheet used for the website.
- include - Conains header/footer/navigation PHP files for the web site.