0% found this document useful (0 votes)
14 views

G12_Experiment-4

The document outlines an experiment focused on writing backend scripts and processing database data using PHP and SQL. It discusses the definition and organization of data and databases, the use of PHP for server-side scripting, and provides a step-by-step guide for connecting PHP to a database using XAMPP. The implementation section includes tasks such as creating data models, validating forms, and generating reports, aimed at enhancing familiarity with web development concepts.

Uploaded by

vedantwadu111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

G12_Experiment-4

The document outlines an experiment focused on writing backend scripts and processing database data using PHP and SQL. It discusses the definition and organization of data and databases, the use of PHP for server-side scripting, and provides a step-by-step guide for connecting PHP to a database using XAMPP. The implementation section includes tasks such as creating data models, validating forms, and generating reports, aimed at enhancing familiarity with web development concepts.

Uploaded by

vedantwadu111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Experiment – 04

Subject- WIM (R4IT3007S)


Batch- D
Group No- 12
Group Members-
211081901- Sampada Deshpande
211080906- Amey Pashte
211081907- Kalyani Shirsath

Aim: Writing Backend Scripts and Processing Database data.

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>

Applications of PHP Scripts:

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.

Database connection using PHP Scripts:

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:

XAMPP web server procedure:

a. Start XAMPP server by starting Apache and MySQL.

b. Write PHP script for connecting to XAMPP.

c. Run it in the local browser.

d. Database is successfully created which is based on the PHP code.

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();
?>

Save the file as “data.php” in htdocs folder under XAMPP folder.

Then open your web browser and type localhost/data.php

Finally the database is created and connected to PHP.

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

You might also like