Professional Documents
Culture Documents
Bus Reservation
Bus Reservation
Traveling is a large growing business across all countries. Bus reservation system deals
with maintenance of records of details of each passenger. It also includes maintenance of
information like schedule and details of each bus.
We observed the working of the Bus reservation system and after going through it, we
get to know that there are many operations, which they have to do manually. It takes a lot of
time and causing many errors while data entry. Due to this, sometimes a lot of problems occur
and they were facing many disputes with customers. To solve the above problem, and further
maintaining records of passenger details, seat availability, price per seat, bill generation and
other things, we are offering this proposal of computerized reservation system.
By using this software, we can reserve tickets from any part of the world, through
telephone lines, via internet. Customer can check availability of bus and reserve selective
seats. The project provides and checks all sorts of constraints so that user does give only
useful data and thus validation is done in an effective way.
1
1. INTRODUCTION
Travel Agencies is a domestic privatized transportation company that runs the vehicles all
over the country. They have several branches at different locations of the country, so that they
can provide the transportation facilities between the places. They want an desktop application
to be developed, where the details of the bookings done and the customer will be updated
from time to time and user can track the details of the available seats immediately
The focus of the project is to computerize traveling company to manage data, so that all
the transactions become fast and there should not be any error in transaction like calculation
mistake, bill generation and other things. It replaces all the paper work. It keeps records of all
bills also, giving to ensure 100% successful implementation of the computerized Bus
reservation system.
This reservation system has three modules. First module helps the customer to enquire
the availability of seats in a particular bus at particular date. Second module helps him to
reserve a ticket. Using third module he can cancel a reserved ticket.
Third module deletes values into from the table on cancellation of tickets.
As the database is hosted using Ms-Access onto internet, the application can access
data from any part of the world, by many number of people concurrently.
2
2. SYSTEM ANALYSIS
Bus Reservation Systems that were suggested till now, are not up to the desired level.
There is no single system which automates all the process.
In order to build the system, all the processes in the business should be studied, System
study helps us under the problem and needs of the application. System study aims at
establishing requests for the system to be acquired, development and installed. It involves
studying and analyzing the ways of an organization currently processing the data to produce
information. Analyzing the problem thoroughly forms the vital part of the system study. In
system analysis, prevailing situation of problem is carefully examined by breaking them into
sub problems. Problematic areas are identified and information is collected. Data gathering is
essential to any analysis of requests. It is necessary that this analysis familiarizes the designer
with objectives, activities and the function of the organization in which the system is to be
implemented.
1. Existing system
Existing system is totally on book and thus a great amount of manual work
has to be done. The amount of manual work increases exponentially with
increase in services.
Needs a lot of working staff and extra attention on all the records.
In existing system, there are various problems like keeping records of items,
seats available, prices of per/seat and fixing bill generation on each bill.
Finding out details regarding any information is very difficult, as the user has
to go through all the books manually.
3
2. Proposed system
The system is very simple in design and to implement. The system requires very
low system resources and the system will work in almost all configurations. It has
got following features:
Needs a lot of working staff and extra attention on all the records.
Any person across the world, having internet can access this service.
Better Service
This would help the corporation prepare and organize its schedules more
efficiently on the basis of traffic demand.
4
3. SOFTWARE REQUIREMENT SPECIFICATION
Hardware Specification
For a system to be used efficiently and accurately, all computer software needs
certain hardware components or other software resources to be present on a computer.
These prerequisites are known as (computer hardware specification) and are often used as
a guideline as opposed to an absolute rule. Most software defines two sets of system
requirements: minimum and recommended. With increasing demand for higher
processing power and resources in newer versions of software, system requirements tend
to increase over time. Industry analysts suggest that this trend plays a bigger part in
driving upgrades to existing computer systems than technological advancements. A
second meaning of the term of System requirements is a generalization of this first
definition, giving the requirements to be met in the design of a system or sub-system.
Typically an organization starts with a set of Business requirements and then derives
the System requirements from there.The most common set of requirements defined by
any operating system or software application is the physical computer resources, also
known as hardware, A hardware requirements list is often accompanied by a hardware
compatibility list (HCL), especially in case of operating systems. An HCL lists tested,
compatible, and sometimes incompatible hardware devices for a particular operating
system or application. The following sub-sections discuss the various aspects of hardware
requirements for this application software
The hardware required includes the following:
1. Hardware Requirements:
o KEYBOARD
o MOUSE
5
Software Specification
The software components used for this project are listed below:
2. Software Requirements:
o Server : XAMP
6
4. MODULES DESCRIPTION
Login: Login Module includes various utilities like User Authentication, Change
Password and Forgot Password.
Registration: In this website provide a some facility user can Registered in this website.
user can use this facility so user can make a registration.
Book the Ticket: In this module admin can add new bus category using this module.
Bus Category contains like Volvo, Slipper coach, Ac Coach etc.
Update Bus Information: In this module admin can add or Update Bus using this
module. It contains the information about the Bus type , photo, description, Location of
tour, Available Seats in Bus etc.
Cancel the Booking Ticket: In this Module User can Cancel the booking Ticket.
2. Bus Ticket Reservation System Application Manage Buses:- Insert the bus
Records this frame insert Bus no,Bus Type and Bus Seats and update , delete and
Refresh Records
3. Bus Ticket Reservation System Application Manage Buses Routes :- This frame
you specify Buses Routes and also specify buses going date and time
4. Bus Ticket Reservation System Application Seats Enquiry :- This frame you
specify From , To and Date (optional) after Press find button show all upcoming
buses enquiry and also show Total seats,Reserve Seats and Remaining Seats
7
then click submit if you want to print this ticket click the print button then show
print preview. Update Reserve and booking seats Application alone
7. Bus Ticket Reservation System Application Fare List :- This frame show fare list
8
5. OVERVIEW OF TECHNOLOGY
PHP is a server scripting language, and a powerful tool for making dynamic and
interactive Web pages.
What is PHP?
It is powerful enough to be at the core of the biggest blogging system on the web
(WordPress)!
PHP files can contain text, HTML, CSS, JavaScript, and PHP code
PHP code are executed on the server, and the result is returned to the browser as
plain HTML
PHP files have extension ".php"
9
What Can PHP Do?
With PHP you are not limited to output HTML. You can output images, PDF files, and
even Flash movies. You can also output any text, such as XHTML and XML.
Why PHP?
What Do I Need?
If your server has activated support for PHP you do not need to do anything.
Just create some .php files, place them in your web directory, and the server will
automatically parse them for you.
10
Because PHP is free, most web hosts offer PHP support.
<?php
// PHP code goes here
?>
A PHP file normally contains HTML tags, and some PHP scripting code.
Below, we have an example of a simple PHP file, with a PHP script that uses a built-in
PHP function "echo" to output the text "Hello World!" on a web page:
Example
<!DOCTYPE html>
<html>
<body>
<?php
echo "Hello World!";
?>
</body>
</html>
In PHP, a variable starts with the $ sign, followed by the name of the variable:
Example
<?php
$txt = "Hello world!";
11
$x = 5;
$y = 10.5;
?>
After the execution of the statements above, the variable $txt will hold the value Hello
world!, the variable $x will hold the value 5, and the variable $y will hold the value 10.5.
Note: When you assign a text value to a variable, put quotes around the value.
Note: Unlike other programming languages, PHP has no command for declaring a
variable. It is created the moment you first assign a value to it.
The PHP Hypertext Preprocessor (PHP) is a programming language that allows web
developers to create dynamic content that interacts with databases. PHP is basically used
for developing web based software applications. This tutorial helps you to build your
base with PHP.
Audience
This tutorial is designed for PHP programmers who are completely unaware of PHP
concepts but they have basic understanding on computer programming.
Prerequisites
Before proceeding with this tutorial you should have at least basic understanding of
computer programming, Internet, Database, and MySQL etc is very helpful.
PHP started out as a small open source project that evolved as more and more people
found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way
back in 1994.
12
It is integrated with a number of popular databases, including MySQL,
PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
PHP supports a large number of major protocols such as POP3, IMAP, and
LDAP. PHP4 added support for Java and distributed object architectures (COM
and CORBA), making n-tier development a possibility for the first time.
PHP performs system functions, i.e. from files on a system it can create, open,
read, write, and close them.
PHP can handle forms, i.e. gather data from files, save data to a file, through
email you can send data, return data to the user.
You add, delete, modify elements within your database through PHP.
Using PHP, you can restrict users to access some pages of your website.
Characteristics of PHP
Simplicity
Efficiency
13
Security
Flexibility
Familiarity
To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an
essential example, first we will create a friendly little "Hello, World!" script.
As mentioned earlier, PHP is embedded in HTML. That means that in amongst your
normal HTML (or XHTML if you're cutting-edge) you'll have PHP statements like this −
<html>
<head>
<title>Hello World</title>
</head>
<body>
</body>
</html>
Hello, World!
If you examine the HTML output of the above example, you'll notice that the PHP code
is not present in the file sent from the server to your Web browser. All of the PHP present
in the Web page is processed and stripped from the page; the only thing returned to the
client from the Web server is pure HTML output.
14
All PHP code must be included inside one of the three special markup tags ATE are
recognised by the PHP Parser.
A most common tag is the <?php...?> and we will also use the same tag in our tutorial.
From the next chapter we will start with PHP Environment Setup on your machine and
then we will dig out almost all concepts related to PHP to make you comfortable with the
PHP language.
Variables can store data of different types, and different data types can do different
things.
String
Integer
Float (floating point numbers - also called double)
Boolean
Array
Object
NULL
Resource
PHP String
A string can be any text inside quotes. You can use single or double quotes:
15
Example
<?php
$x = "Hello world!";
$y = 'Hello world!';
echo $x;
echo "<br>";
echo $y;
?>
PHP Integer
In the following example $x is an integer. The PHP var_dump() function returns the data
type and value:
Example
<?php
$x = 5985;
var_dump($x);
?>
16
PHP - A Simple HTML Form
The example below displays a simple HTML form with two input fields and a submit
button:
Example
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
When the user fills out the form above and clicks the submit button, the form data is sent
for processing to a PHP file named "welcome.php". The form data is sent with the
HTTP POST method.
To display the submitted data you could simply echo all the variables. The
"welcome.php" looks like this:
<html>
<body>
17
</body>
</html>
The output could be something like this:
Welcome John
Your email address is john.doe@example.com
The same result could also be achieved using the HTTP GET method:
Example
<html>
<body>
<html>
<body>
Welcome <?php echo $_GET["name"]; ?><br>
Your email address is: <?php echo $_GET["email"]; ?>
</body>
</html>
The code above is quite simple. However, the most important thing is missing. You need
to validate form data to protect your script from malicious code.
18
Think SECURITY when processing PHP forms!
This page does not contain any form validation, it just shows how you can send and
retrieve form data.
However, the next pages will show how to process PHP forms with security in mind!
Proper validation of form data is important to protect your form from hackers and
spammers!
In order to develop and run PHP Web pages three vital components need to be installed
on your computer system.
Web Server − PHP will work with virtually all Web Server software, including
Microsoft's Internet Information Server (IIS) but then most often used is freely
available Apache Server. Download Apache for free here
− https://httpd.apache.org/download.cgi
Database − PHP will work with virtually all database software, including Oracle
and Sybase but most commonly used is freely available MySQL database.
Download MySQL for free here − https://www.mysql.com/downloads/
PHP Parser − In order to process PHP script instructions a parser must be
installed to generate HTML output that can be sent to the Web Browser. This
tutorial will guide you how to install PHP parser on your computer.
Before you proceed it is important to make sure that you have proper environment setup
on your machine to develop your web programs using PHP.
http://127.0.0.1/info.php
19
If this displays a page showing your PHP installation related information then it means
you have PHP and Webserver installed properly. Otherwise you have to follow given
procedure to install PHP on your computer.
This section will guide you to install and configure PHP over the following four
platforms −
Apache Configuration
If you are using Apache as a Web Server then this section will guide you to edit Apache
Configuration Files.
The PHP configuration file, php.ini, is the final and most immediate way to affect PHP's
functionality.
To configure IIS on your Windows machine you can refer your IIS Reference Manual
shipped along with IIS.
This chapter will give you an idea of very basic syntax of PHP and very important to
make your PHP foundation strong.
20
Escaping to PHP
The PHP parsing engine needs a way to differentiate PHP code from other elements in
the page. The mechanism for doing so is known as 'escaping to PHP'. There are four
ways to do this −
<?php...?>
If you use this style, you can be positive that your tags will always be correctly
interpreted.
<?...?>
Short tags are, as one might expect, the shortest option You must do one of two things to
enable PHP to recognize the tags −
ASP-style tags
ASP-style tags mimic the tags used by Active Server Pages to delineate code blocks.
ASP-style tags look like this −
<%...%>
To use ASP-style tags, you will need to set the configuration option in your php.ini file.
21
HTML script tags
A comment is the portion of a program that exists only for the human reader and stripped
out before displaying the programs result. There are two commenting formats in PHP −
Single-line comments − They are generally used for short explanations or notes relevant
to the local code. Here are the examples of single line comments.
The smallest building blocks of PHP are the indivisible tokens, such as numbers
(3.14159), strings (.two.), variables ($two), constants (TRUE), and the special words that
make up the syntax of PHP itself like if, else, while, for and so forth.
Although statements cannot be combined like expressions, you can always put a
sequence of statements anywhere a statement can go by enclosing them in a set of curly
braces.
22
Here both statements are equivalent −
if (3 == 2 + 1)
if (3 == 2 + 1) {
print("lost my mind.<br>");
Yes you can run your PHP script on your command prompt. Assuming you have
following content in test.php file
<?php
?>
$ php test.php
Hello PHP!!!!!
Arithmetic Operators
Comparison Operators
Logical (or Relational) Operators
Assignment Operators
Conditional (or ternary) Operators
23
Lets have a look on all operators one by one.
Arithmetic Operators
Show Examples
Comparison Operators
Show Examples
> Checks if the value of left operand is greater than the value of (A > B) is not
24
right operand, if yes then condition becomes true. true.
< Checks if the value of left operand is less than the value of (A < B) is
right operand, if yes then condition becomes true. true.
>= Checks if the value of left operand is greater than or equal to (A >= B) is
the value of right operand, if yes then condition becomes true. not true.
<= Checks if the value of left operand is less than or equal to the (A <= B) is
value of right operand, if yes then condition becomes true. true.
Logical Operators
Show Examples
and Called Logical AND operator. If both the operands are true (A and B) is
then condition becomes true. true.
&& Called Logical AND operator. If both the operands are non (A && B) is
zero then condition becomes true. true.
! Called Logical NOT Operator. Use to reverses the logical state !(A && B)
of its operand. If a condition is true then Logical NOT operator is false.
will make false.
Assignment Operators
Show Examples
25
Operator Description Example
Conditional Operator
There is one more operator called conditional operator. This first evaluates an expression
for a true or false value and then execute one of the two given statements depending upon
the result of the evaluation. The conditional operator has this syntax Show Examples
Operators Categories
All the operators we have discussed above can be categorised into following categories −
26
The conditional operator (a ternary operator), which takes three operands and
evaluates either the second or third expression, depending on the evaluation of the
first expression.
Assignment operators, which assign a value to a variable.
Operator precedence determines the grouping of terms in an expression. This affects how
an expression is evaluated. Certain operators have higher precedence than others; for
example, the multiplication operator has higher precedence than the addition operator −
For example x = 7 + 3 * 2; Here x is assigned 13, not 20 because operator * has higher
precedence than + so it first get multiplied with 3*2 and then adds into 7.
Here operators with the highest precedence appear at the top of the table, those with the
lowest appear at the bottom. Within an expression, higher precedence operators will be
evaluated first.
27
DATA BASE OVERVIEW
MySQL
MySQL is the most popular Open Source Relational SQL Database Management System.
MySQL is one of the best RDBMS being used for developing various web-based
software applications. MySQL is developed, marketed and supported by MySQL AB,
which is a Swedish company. This tutorial will give you a quick start to MySQL and
make you comfortable with MySQL programming.
Audience
This tutorial is prepared for the beginners to help them understand the basics-to-advanced
concepts related to MySQL languages.
Prerequisites
Before you start doing practice with various types of examples given in this tutorial, it is
being assumed that you are already aware about what a database is, especially an
RDBMS and what is a computer programming language.
What is a Database?
A database is a separate application that stores a collection of data. Each database has one
or more distinct APIs for creating, accessing, managing, searching and replicating the
data it holds.
Other kinds of data stores can also be used, such as files on the file system or large
hash tables in memory but data fetching and writing would not be so fast and easy with
those type of systems.
28
stored into different tables and relations are established using primary keys or other keys
known as Foreign Keys.
RDBMS Terminology
Before we proceed to explain the MySQL database system, let us revise a few definitions
related to the database.
29
MySQL Database
MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses.
MySQL is developed, marketed and supported by MySQL AB, which is a Swedish
company. MySQL is becoming so popular because of many good reasons −
MY SQL INSTALATION
Installing MySQL on Linux/UNIX
The recommended way to install MySQL on a Linux system is via RPM. MySQL AB
makes the following RPMs available for download on its website −
MySQL − The MySQL database server manages the databases and
tables, controls user access and processes the SQL queries.
MySQL-client − MySQL client programs, which make it possible to connect
to and interact with the server.
MySQL-devel − Libraries and header files that come in handy when compiling
other programs that use MySQL.
30
MySQL-shared − Shared libraries for the MySQL client.
MySQL-bench − Benchmark and performance testing tools for the MySQL
database server.
The MySQL RPMs listed here are all built on a SuSE Linux system, but they will
usually work on other Linux variants with no difficulty.
Now, you will need to adhere to the steps given below, to proceed with the installation −
Login to the system using the root user.
Switch to the directory containing the RPMs.
Install the MySQL database server by executing the following command.
Remember to replace the filename in italics with the file name of your RPM.
[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm
The above command takes care of installing the MySQL server, creating a user of
MySQL, creating necessary configuration and starting the MySQL server automatically.
You can find all the MySQL related binaries in /usr/bin and /usr/sbin. All the tables and
databases will be created in the /var/lib/mysql directory.
The following code box has an optional but recommended step to install the
remaining RPMs in the same manner −
[root@host]# rpm -i MySQL-client-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-devel-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-shared-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-bench-5.0.9-0.i386.rpm
Installing MySQL on Windows
The default installation on any version of Windows is now much easier than it used to be,
as MySQL now comes neatly packaged with an installer. Simply download the installer
package, unzip it anywhere and run the setup.exe file.
The default installer setup.exe will walk you through the trivial process and by default
will install everything under C:\mysql.
Test the server by firing it up from the command prompt the first time. Go to the location
of the mysqld server which is probably C:\mysql\bin, and type −
mysqld.exe --console
31
NOTE − If you are on NT, then you will have to use mysqld-nt.exe instead of
mysqld.exe
If all went well, you will see some messages about startup and InnoDB. If not, you may
have a permissions issue. Make sure that the directory that holds your data is accessible
to whatever user (probably MySQL) the database processes run under.
MySQL will not add itself to the start menu, and there is no particularly nice GUI way to
stop the server either. Therefore, if you tend to start the server by double clicking the
mysqld executable, you should remember to halt the process by hand by using
mysqladmin, Task List, Task Manager, or other Windows-specific means.
Verifying MySQL Installation
After MySQL, has been successfully installed, the base tables have been initialized and
the server has been started: you can verify that everything is working as it should be via
some simple tests.
Use the mysqladmin Utility to Obtain Server Status
Use mysqladmin binary to check the server version. This binary would be available in
/usr/bin on linux and in C:\mysql\bin on windows.
[root@host]# mysqladmin --version
It will produce the following result on Linux. It may vary depending on your installation
−
mysqladmin Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386
If you do not get such a message, then there may be some problem in your installation
and you would need some help to fix it.
Execute simple SQL commands using the MySQL Client
You can connect to your MySQL server through the MySQL client and by using
the mysql command. At this moment, you do not need to give any password as by default
it will be set as blank.
You can just use following command −
[root@host]# mysql
It should be rewarded with a mysql> prompt. Now, you are connected to the MySQL
server and you can execute all the SQL commands at the mysql> prompt as follows −
mysql> SHOW DATABASES;
32
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.13 sec)
Post-installation Steps
MySQL ships with a blank password for the root MySQL user. As soon as you have
successfully installed the database and the client, you need to set a root password as given
in the following code block −
[root@host]# mysqladmin -u root password "new_password";
Now to make a connection to your MySQL server, you would have to use the following
command −
[root@host]# mysql -u root -p
Enter password:*******
UNIX users will also want to put your MySQL directory in your PATH, so you won't
have to keep typing out the full path everytime you want to use the command-line client.
For bash, it would be something like −
export PATH = $PATH:/usr/bin:/usr/sbin
Running MySQL at Boot Time
If you want to run the MySQL server at boot time, then make sure you have the following
entry in the /etc/rc.local file.
/etc/init.d/mysqld start
Also,you should have the mysqld binary in the /etc/init.d/ directory.
MySQL-PHP SYSTAX
MySQL works very well in combination of various programming languages like PERL,
C, C++, JAVA and PHP. Out of these languages, PHP is the most popular one because of
its web application development capabilities.
33
This tutorial focuses heavily on using MySQL in a PHP environment. If you are
interested in MySQL with PERL, then you can consider reading the PERLTutorial.
PHP provides various functions to access the MySQL database and to manipulate the
data records inside the MySQL database. You would require to call the PHP functions in
the same way you call any other PHP function.
The PHP functions for use with MySQL have the following general format
− mysql_function(value,value,...);
The second part of the function name is specific to the function, usually a word that
describes what the function does. The following are two of the functions, which we will
use in our tutorial −
mysqli_connect($connect);
mysqli_query($connect,"SQL
statement");
The following example shows a generic syntax of PHP to call any MySQL function.
<html>
<head>
<title>PHP with MySQL</title>
</head>
<body>
<?php
$retval = mysql_function(value, [value,...]);
if( !$retval ) {
die ( "Error: a related error message" );
}
// Otherwise MySQL or PHP Statements
?>
</body>
</html>
Starting from the next chapter, we will see all the important MySQL functionality along
with PHP.
34
MySQL Connection Using MySQL Binary
You can establish the MySQL database using the mysql binary at the command prompt.
Example
Here is a simple example to connect to the MySQL server from the command prompt −
[root@host]# mysql -u root -p
Enter password:******
This will give you the mysql> command prompt where you will be able to execute any
SQL command. Following is the result of above command −
The following code block shows the result of above code −
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2854760 to server version: 5.0.9
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
In the above example, we have used root as a user but you can use any other user as well.
Any user will be able to perform all the SQL operations, which are allowed to that user.
You can disconnect from the MySQL database any time using the exitcommand at
mysql> prompt.
mysql> exit
Bye
MySQL Connection Using PHP Script
PHP provides mysql_connect() function to open a database connection. This function
takes five parameters and returns a MySQL link identifier on success or FALSE on
failure.
Syntax
connection mysql_connect(server,user,passwd,new_link,client_flag);
server
1
Optional − The host name running the database server. If not specified, then
35
the default value will be localhost:3306.
user
2 Optional − The username accessing the database. If not specified, then the
default will be the name of the user that owns the server process.
passwd
3 Optional − The password of the user accessing the database. If not specified,
then the default will be an empty password.
new_link
Optional − If a second call is made to mysql_connect() with the same
4 arguments, no new connection will be established; instead, the identifier
of the already opened connection will be returned.
client_flags
Optional − A combination of the following constants −
MYSQL_CLIENT_SSL − Use SSL encryption.
MYSQL_CLIENT_COMPRESS − Use compression protocol.
5 MYSQL_CLIENT_IGNORE_SPACE − Allow space after function
names.
MYSQL_CLIENT_INTERACTIVE − Allow interactive
timeout seconds of inactivity before closing the connection.
You can disconnect from the MySQL database anytime using another PHP
function mysql_close(). This function takes a single parameter, which is a connection
returned by the mysql_connect() function.
Syntax
bool mysql_close ( resource $link_identifier );
If a resource is not specified, then the last opened database is closed. This function
returns true if it closes the connection successfully otherwise it returns false.
36
37
Example
Try the following example to connect to a MySQL server −
<html>
<head>
<title>Connecting MySQL Server</title>
</head>
<body>
<?php
$dbhost = 'localhost:3306';
$dbuser = 'guest';
$dbpass = 'guest123';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($conn);
?>
</body>
</html>
MySQL-CREATE DATABASE
Create Database Using mysqladmin
You would need special privileges to create or to delete a MySQL database. So assuming
you have access to the root user, you can create any database using the
mysql mysqladmin binary.
Example
Here is a simple example to create a database called TUTORIALS −
[root@host]# mysqladmin -u root -p create TUTORIALS
Enter password:******
This will create a MySQL database called TUTORIALS.
38
Create a Database using PHP Script
PHP uses mysql_query function to create or delete a MySQL database. This function
takes two parameters and returns TRUE on success or FALSE on failure.
Syntax
bool mysql_query( sql, connection );
Example
The following example to create a database −
<html>
<head>
<title>Creating MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn
); if(! $retval ) {
39
die('Could not create database: ' . mysql_error());
}
echo "Database TUTORIALS created successfully\n";
mysql_close($conn);
?>
</body>
</html>
40
6. SYSTEM DESIGN
Conceptual design
Requirement Analysis:
List of Entities:
BUS
PASSENGER
ROUTE
RESERVE
List of attributes:
BUS:
Bus ID
AC
Fare
Departure Time
Arrival Time
ROUTE:
Route id
Origin
Destination
PASSENGER:
Passenger ID
Username
Password
Name
41
Mobile number
RESERVE:
Ticket ID
Seat
Time Stamp
Passenger ID
Bus ID
Date
FUNCTIONAL SPECIFICATION
USER
• This Project basically provides a Bus information and regarding bus information .
• First of all, in our website any user or visitor are view our system and also search the
bus and how many seats are available in our buses.
• User can also registered its own seats in bus this website . User can post a comment on
different Bus Services. But user can compulsory registered first in the system.
ADMIN
In this system admin can maintain all the Bus information and also maintain Bus
category, comments etc.
• In this system admin can maintain the registered users, manage news, and also admin
can generates a reports and manage the whole system.
42
SYTEM FLOW CHART
DFD
43
USE CASE DIAGRAM
44
ACTIVITY DIAGRAM
Action Flow
Action flows, also called edges and paths, illustrate the transitions from one action state
to another. They are usually drawn with an arrowed line.
Object Flow
Object flow refers to the creation and modification of objects by activities. An object
flow arrow from an action to an object means that the action creates or influences the
object. An object flow arrow from an object to an action indicates that the action state
uses the object.
45
Decisions and Branching
A diamond represents a decision with alternate paths. When an activity requires a
decision prior to moving on to the next activity, add a diamond between the two
activities. The outgoing alternates should be labeled with a condition or guard expression.
You can also label one of the paths "else."
Guards
In UML, guards are a statement written next to a decision diamond that must be true
before moving next to the next activity. These are not essential, but are useful when a
specific answer, such as "Yes, three labels are printed," is needed before moving forward.
Synchronization
A fork node is used to split a single incoming flow into multiple concurrent flows. It is
represented as a straight, slightly thicker line in an activity diagram.
A join node joins multiple concurrent flows back into a single outgoing flow.
A fork and join mode used together are often referred to as synchronization.
46
Time Event
This refers to an event that stops the flow for a time; an hourglass depicts it.
Merge Event
A merge event brings together multiple flows that are not concurrent.
47
Interrupting Edge
An event, such as a cancellation, that interrupts the flow denoted with a lightning bolt.
Swimlanes
Swimlanes group related activities into one column.
48
7. TESTING
System Testing:
System testing is actually a series different test whose primary purpose is to full exercise
the computer base system .Where the software and other system elements are tested as
whole .To test computer software, we spiral out along streamlines that broadens the scope
of testing with each turn.
The last higher-order testing step falls outside the boundary of software Engineering and
in to the broader context of computer system engineering.Software,once validated, must
be combining with order system Elements(e.g.hardware,people,databases).System testing
verifies that all the elements Mesh properly and that overall system
function/performanceis achieved.
1. Recovery Testing
2. Security Testing
3. Stress Testing
UnitTesting:This is the testing process which we can do manually because in this testing
program is a tested individually using dummy record to see whether that program
produce satisfied output as the company and validation also.
2. Configuration review
49
Different types of test cases:
50
These cases are usually written by the testing team but the design team may also be
involved as they are most familiar with the interface. User interface test cases are the
types of test cases in software testing that usually drive cross-browser testing. Browsers
tend to render things differently, and user interface test cases help ensure your application
behaves consistently across multiple browsers.
These test cases will be run once the development phase is complete and the UI is hooked
up to the database.
Example: What happens when the website is viewed on a small screen such as a mobile
phone? Does the UI break?
51
They verify that modules that are already working individually are also able to work
together.
Example: Checking the link between the home page and the “favorites” section. When
you add an item as a “favorite”, from the homepage, does it appear in the “favorites”
section?
Usability Test Cases
Usability test cases can often be referred to as “tasks” or “scenarios”. Rather than
providing detailed step-by-step instructions to execute the test, the tester is presented with
a high level scenario or task to complete.
Usability test cases help identify how a user naturally approaches and uses the
application. They help guide the tester through various situations and flows. No prior
knowledge of the application is necessary.
These test cases are typically prepared by the design team alongside the testing team.
Usability testing should be done prior to user acceptance testing.
Example: Can the user successfully add more than one item to their shopping cart? What
is that experience like?
Database Test Cases
Test cases for database testing examine what’s happening behind the scenes. The user
interface is clean, and everything appears to be working… but where is all that data
going?
In order to write these test cases, you need to have a strong understanding of the entire
application, the database tables, and the the stored procedures. The testing team will often
use SQL queries to develop database test cases.
Database tests are used to verify the developer has written the code in a way that stores
and handles data in a consistent, safe manner.
Example: Let’s consider the creation of a user profile. When the user submits their
profile, the following should be tested in regards to the database.
1. Did the application store the inputted data in the database?
2. Was any data lost in the process?
3. Partially performed data should not have been saved.
4. Unauthorized users should not be able to view or access the user’s information.
52
Security Test Cases
Security test cases help ensure the application restricts actions and permissions wherever
necessary. These test cases are written to protect data when and where it needs to be
safeguarded.
Security test cases are used to drive penetration testing and other types of security-based
tests.
Authentication and encryption are often the main focus in security test cases. The security
team (if one exists) is usually responsible for writing and conducting these tests.
Example: If a user reaches X number of failed login attempts, does the account become
locked? Is a user able to upload data without being logged in?
User Acceptance Test Cases
User acceptance test cases, or “UAT” test cases, help the team test the user acceptance
testing environment. These test cases should be broad, covering all areas of the
application.
The purpose of these test cases isn’t to find bugs (hopefully they’ve already been found
and fixed in previous testing), but to verify the application is acceptable to the user. So,
when they execute a test, are the results of that test, and the experience of that test
acceptable?
Since many other types of testing have already been done by the time UAT starts, the
focus is not so much on a granular level, but more so on the bigger picture. User
acceptance test cases are used by the end-user or client and prepared by the testing team
or product manager. This is perhaps the most important phase of testing as it is the last
step before going into production.
Example: If testing for instance, a photo management application for a photography
studio, the client (the user) should test that they are able to upload and manage their
photos in a way that fits their business needs.
Finally
Test cases come in all different shapes and sizes. Depending on the type of test case
being written, you may need a more technical background, or one in UX in order to
effectively write a good test case.
53
Each type of software testing requires different types of test cases. By considering the
above types of test cases when you design your tests, you’ll maximize test coverage and
go into the release with more confidence.
the main focus of black box White Box Testing (Unit Testing) validates internal
testing is on the validation of structure and working of your software code
your functional requirements.
Black box testing facilitates White box testing does not facilitate testing
testing communication amongst communication amongst modules
modules
54
8. OUTPUTS
55
56
57
58
9. CONCLUSION
Bus Reservation system, which enable customer to check availability bus ticket, buy
bus ticket, and pay bus ticket online. It makes the customer easy to get bus ticket online
instead of queue up to buy the bus ticket.
The new system needs less manpower; provide facility for Book Ticket sand Latest
News for bus information.
59
Future Enhancement
We think that not a single project is ever considered as complete forever. Because
our mind is always thinking something new and our necessities also are growing day by
day. We always want something more than what we have. Our application also , If you
see at the first glance then you find it to be complete but we want to make it still mature
and fully automatically. The future perspective of our project can linking our booking
system with other centralized bus services so that user has an ease of booking and
travelling. Other then this for long route journeys food facility and its variety can be
added. With the use of GPS every traveler can get advance map of route to be followed
during journey. Making a mobile app for the user is also a first step development.
60
10. Bibliography
During the development of our system, we have taken the reference from Books
which we would like to mentioning this section. These books acted as our tutors during
the system development.
Besidesthesewewerereferringtheonlinemanualsfromthesites.
www.google.com
www.APSRTC.com
www.neeta.com
www.gujrat.com
www.paswanath.com
61