G12_Experiment-4
G12_Experiment-4
Data:
Data is a collection of a distinct small unit of information. It can be used in a variety of forms
like text, numbers, media, bytes, etc. it can be stored in pieces of paper or electronic memory
In computing, Data is information that can be translated into a form for efficient movement
and processing. Data is interchangeable.
Database:
A database is an organized collection of data, so that it can be easily accessed and managed.
You can organize data into tables, rows, columns, and index it to make it easier to find
relevant information.
Database handlers create a database in such a way that only one set of software program
provides access of data to all the users.
The main purpose of the database is to operate a large amount of information by storing,
retrieving, and managing data.
There are many dynamic websites on the World Wide Web nowadays which are handled
through databases. For example, a model that checks the availability of rooms in a hotel. It is
an example of a dynamic website that uses a database.
There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.
Modern databases are managed by the database management system (DBMS).
SQL or Structured Query Language is used to operate on the data stored in a database. SQL
depends on relational algebra and tuple relational calculus.
25
PHP:
PHP is an open-source, server-side general scripting language that has now become a de-
facto coding standard in the web development industry.
It can be learned easily, and if one is from a coding background, he (or she) will find it very
simple. This is why many are using PHP to polish up their entry-level coding skills.
PHP runs on different operating systems, like Windows, UNIX, Linux and supports different
databases like MySQL, Microsoft Access, and Oracle. PHP can not only collect form data,
but it can also create, read, write, delete, and close files on the server.
It can be easily embedded in HTML. PHP code is embedded in HTML with tags <?php ?>.
Example:
1. <html>
2. <title>Getting Started With PHP</title>
3. <body>
4.
5. <?php
6. echo”Your first PHP code”;
7. ?>
8.
9. </body>
10. </html>
1. Server-Side Scripting:
Server side scripting is the first purpose of PHP. All you need to start working on a
desktop PC with PHP is a PHP Parser, a webserver (such as Apache) and a web
browser like Google Chrome.
2. Command Line Scripting:
If you want to use PHP programming on Linux or task scheduler on Windows, then
you don’t really need a web server, but only a PHP Parser. This is called “command line
scripting”.
25
3 . Desktop Applications:
Although, PHP is not a suitable language for development of desktop applications, but it
supports some advanced features like PHP-GTK which is basically an extension of PHP.
PHP-GTK provides object-oriented user interface.
The collection of related data is called a database. XAMPP stands for cross-platform,
Apache, MySQL, PHP, and Perl. It is among the simple light-weight local servers for website
development.
Requirements:
In PHP, we can connect to the database using XAMPP web server by using the following
path.
"localhost/phpmyadmin"
Steps:
1. Open XAMPP and start running Apache, MySQL and FileZilla
25
Now open your PHP file and write your PHP code to create database and a table in your
database.
PHP code to create a database:
<?php
// Server name must be localhost
$servername = "localhost";
// In my case, user name will be root
$username = "root";
// Password is empty
$password = "";
// Creating a connection
$conn = new mysqli($servername,
$username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failure: "
. $conn->connect_error);
}
// Creating a database named geekdata
$sql = "CREATE DATABASE geekdata";
if ($conn->query($sql) === TRUE) {
echo "Database with name geekdata";
25
} else {
echo "Error: " . $conn->error;
}
// Closing connection
$conn->close();
?>
If you want to see your database, just type localhost/phpmyadmin in the web browser and the
database can be found.
25
Implementation:
1. Create Data Model (ER Model) and Database design using SQL, prefer
Postgres RDBMS
25
2. Connect this database to your already created Data Entry Form.
25
3. Write data into the database through Data Entry forms, and Retrieve the same to
display on Data Entry Form and Web Records (display in row-column format on
webpage). Edit/Update the Record at form level itself.
25
4. Include, large files, image, and video data to store and retrieve (upload and
download).
5. All the data entry forms should have php scripted validations.
25
6. Write a session script to create active login session, expiry of session
will will store the data temporary.
7. Create pdf report (through PhP) of the filled data and send to the user through
email. (Try JasperReports, iReport like reporting and visualization tools)
Conclusion: This assignment made us familiar with the concept of various web pages.
25