Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

WEB APPLICATIONS DEVELOPMENT

PHP/MySQL

Week 9
WEB APPLICATIONS DEVELOPMENT - CIT

Prayer for today


Ama sa Langit, bigyan kami ngayong araw upang matupad ang aming
mga tungkulin bilang responsable at mabait na mag-aaral.
Bigyan kami ng gabay at pangangalaga sa pagtupad ng aming mga
gawain.
Bigyan mo kami ng tulong sa mga desisyon na aming ginagawa.
Nanalangin kami sa iyo na pagpalain ang aming mga guro para sa
matiyagang paghahatid sa amin araw-araw na mga aralin.
Pagpalain ang aming mga magulang sa patuloy na pagsuporta sa amin.
Maraming salamat, Lord sa lahat ng mga biyayang ibinibigay mo sa
aming lahat. Ikaw ang aming suporta at lakas.
Amen.
2
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
WEB APPLICATIONS DEVELOPMENT - CIT

Learning Outcomes
1. Connecting to Database with MySQL
2. Importing and Exporting the Database file.
3. Getting the data using while loop query.
4. Performing CRUD (Create, Read, Update and Delete) functions.

3
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
Connecting to the Database
With MySQL
Using these line of codes, we can
connect PHP into MySQL database.
db_connection.php
WEB APPLICATIONS DEVELOPMENT - CIT

Connecting to the Database with MySQL


- By creating this database connection, we will used it throughout the
whole application.
- Every PHP file that we created, we need to include this database
connection file.
- Make sure that your MySQL database in the XAMPP application is
running.
- 3306 is the port of MySQL (please don’t change it!)

6
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
Importing and Exporting the
database file
WEB APPLICATIONS DEVELOPMENT - CIT

How the import and export important in


MySQL?
- If you’re making a weekly backup with your database, you can export
the database in a weekly basis.
- If you’re doing your project on the different computers, you can
export the database and import it to the new computer.
- You are confident that you have a copy of your database just in case
the server goes down.

8
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
WEB APPLICATIONS DEVELOPMENT - CIT

Exporting the database


It will generate a SQL file, once click the ‘Go’ button.

9
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
WEB APPLICATIONS DEVELOPMENT - CIT

Importing the database


Import your database file that you’ve downloaded or exported.
Make sure that it’s a SQL file.

10
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
Getting the data in the database
and run in with while loop
WEB APPLICATIONS DEVELOPMENT - CIT

Input it on your PHP file then run it using


while loop.

12
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
Performing CRUD (Create, Read,
Update, Delete) functions.
WEB APPLICATIONS DEVELOPMENT - CIT

Inserting the data to the table

14
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
WEB APPLICATIONS DEVELOPMENT - CIT

Updating the data from the table

15
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN
WEB APPLICATIONS DEVELOPMENT - CIT

Deleting the data from the table

16
SYSTEMS PLUS COMPUTER COLLEGE - CALOOCAN

You might also like