Professional Documents
Culture Documents
XAMPP
Introduction to XAMPP
Objectives
At the end of this chapter, you should be able to:
• Install XAMPP
• Create a MySQL database
• Insert, update and delete data in tables
• Connect to MySQL database using PHP
• Insert records in database using PHP
• Validate forms using PHP
Introduction
MySQL is a mainly popular open source database, it allows the user to store data in
database in form of tables using SQL (Structured Query Language). MySQL is a
relational database because data can be stored in multiple related tables and these
data can be used as single store storage and retrieve these data electronically from
multiple tables.
Installation of XAMPP
Inserting Values
Now we have created a database called Botho University along
with a table called Students, let us insert values in our table.
1. Click insert tab and enter values for the first row and click Go
button to save the record.
2. Repeat the previous step to enter another record.
Selecting and Updating Values
1. When you are in table view, the table shows the records
entered, in order to update a record in a table, select a
record to be updated by clicking on the checkbox and Click a
pencil icon
2. A window that allows you to update the values will appear,
and you can now update your records and click Go button to
save the changes.
Deleting a record
National ID Int 15
Firstname Varchar 30
Surname Varchar 30
Phone NO Int 15
4. National ID is a Primary key
5. Enter 5 records in your table
Establishing Connection to
MySQL
We have learnt how to create a database using MySql. Now
we are going to connect to your database called Botho
University, this is an essential step to allow your commands
to be executed, before you can connect to database make
sure that all your files are saved in htdocs .
Running PHP scripts in Xammp
<?php
echo "My first PHP script!";
?>
</body>
</html>
To run the script type the following :
http://localhost/wcd/ as the URL . The following screen will
appear.
Click the script to
run
Connecting to the database
Some of functions that we are going to use in order to connect
to our database and enter records:
Functions Results
echo"registration Successful";
?>
Now run the registration form in htdocs and enter your first
record as shown below and click Submit Form button to
submit your data into a database
Form Validation
From this chapter you have learnt how to install XAMPP and basics of PHP and
MYSQL. XAMPP is an Apache distribution with the most collective web development
technologies. It can be used for testing applications in PHP and MySQL. It can be
easily installed and used in all platforms. A database is a collection of data from a
base and MYSQL is the most popular database for web servers. We have learnt how
to insert values to a table using PHP. Form validation was used to validate the data
so that the form does not all null values to be submitted to the database.