0% found this document useful (0 votes)
32 views10 pages

Web Development Lesson 8..

Uploaded by

elistragis
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
32 views10 pages

Web Development Lesson 8..

Uploaded by

elistragis
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

WEB DEVELOPMENT 1

Learning Groups: P107, P108, E101, P102


Lecturer: Mr. Maina Samuel
week 8 learning topics

 Creating and Connecting Database to a PHP Registration Form


 8.1 Creating tables in Maria DB using SQL commands.
 8.2 Creating a registration form
 8.3 Storing data in the database
 8.4 Fetching data from the Database (using CRUD operation) Create, Read,
Update &delete
 Revision apart Create and Read Revise on your own Update &delete when
updating a form.

(using SQL language)

8.0 PHP form registration


A database is a critical tool when it comes to software development. It helps you
manage different information or records. A database such as MYSQL is used by
numerous developers worldwide.

This document shows you how to use Maria database in PHP.

Introduction

Maria Database is one of the most popular relational database management system
(DBMS). It is an open source version of MySQL database. Maria Database is based on
Structured Query Language (SQL). SQL is a standard language for creating, storing,
and fetching data in databases. we are going to learn how to use Maria Database and
PHP in windows.

8.1 Creating tables in Maria DB using SQL commands.

Now that we have our environment working, we can start working with Maria DB.

1|P ag e
create database school;

Step 2: select the database to use. ty command – use school;

Database to be changed

Step 3: Now, let’s create a table named students.

Use the following table commands to assist you in filling the form below it.

2|P ag e
Comments:

How to create students table: select database name on left column >then select new
>table dash board will appear as illustrated on the above image

 Fill the remaing details with the help of the table commands @ image step 3
when through click save button located near preview SQL
 Incase you want to add fields >click the column(s)Go button to add other
fields.


 To see the created table

3|P ag e
 So far, we have created a database school and a table student inside it. Now, let’s
view this database school and its tables in PhpMyAdmin. Open your browser and
navigate to http://localhost/phpmyadmin/. You should see something like this.
 Select school database Click students then structure Tab to Check table fields
exist.

8.2 Creating a registration form

Here, we will create a form and store the data collected from it in our school database.

We will Create two files, index.php and connect.php.

The file index.php will carry the form HTML code, while connect.php connects the
form with the database.

4|P ag e
Save as index.php

Next document

Style.css

5|P ag e
Save as Style.css

The page should now look like this:

6|P ag e
Now, let’s connect our form with the database.

Save as connect.php :

7|P ag e
8.3 Storing data in the database

When we open http://localhost/phpmyadmin/ on the browser we should have


something like this in our database.

 Open index.php >fill in the registration form


 After filling the form >click login then if results are successful Record saved

 When we open http://localhost/phpmyadmin/ on the browser we should


have something like this in our database.

8|P ag e
 8.4 Fetching data from the Database (using CRUD operation) Create, Read,
Update &delete

To fetch the data that we just saved, add the code below
into index.php right under the </form> tag.

9|P ag e
On refreshing the page, we should see:

The data at the bottom of the page has been fetched from the database.

10 | P a g e

You might also like