0% found this document useful (0 votes)
68 views13 pages

Activity 10

The document provides step-by-step instructions for developing a simple student enrollment database and insert function using PHP and PDO. It describes creating an "Enrollment" database and "student" table in MySQL, setting up file directories and PHP files for database connection, classes, functions, and scripts for adding a new student record and checking if it was saved successfully. The output is to be submitted in a Word document with screenshots and a photo of the student working on the task.
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)
68 views13 pages

Activity 10

The document provides step-by-step instructions for developing a simple student enrollment database and insert function using PHP and PDO. It describes creating an "Enrollment" database and "student" table in MySQL, setting up file directories and PHP files for database connection, classes, functions, and scripts for adding a new student record and checking if it was saved successfully. The output is to be submitted in a Word document with screenshots and a photo of the student working on the task.
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/ 13

Activity 10

We will develop a simple insert function using PHP in a PDO way. Follow the steps provided. Make sure that you have
already installed XAMPP in your computer. Once installed, run Apache and MySQL services.

1. Create a database for Enrollment

2. Enter the enrollment database details.


3. Click the New Table to create.

4. Enter the attributes/fields for the student table. Make sure that the unique ID (student_id) is being marked by a
primary key by simply clicking the blank column besides Not null column.

The Auto increment box is also checked. This is applicable only to the unique key.
5. Save the table named “student”.
6. Here is now the list of table/s under the Enrollment database.

After clicking the student table.

7. Create a folder for your directory.


8. Go to C:/Xampp/htdocs/
9. Name the folder to “gadtc-enrollment”.

10. Open the gadtc-enrollment folder and make 3 folders. These are:

 config folder
 functions folder
 objects folder
11. Open sublime or any editor.
12. From the file menu, click the Open Folder and select the gadtc-enrollment file from the htdocs.

13. Copy the following and save it as “connection.php” the config folder.
14. Open new file and copy below. Save it as “student.php”. The object folder serves as your table from the
database. Under this file, we are creating a class named Student that contains attributes and methods.
15. Open again another file and name it as “add_student.php”. Save the file under the gadtc-enrollment folder.
Copy the code below.
16. Create an action script name it as “action_add.php”. Save the file under the gadtc-enrollment folder. Make sure
that the functions or files that have been called must be included by using the code “include_once”. Copy the
code below.
17. Create a new file named “savefunction.php” and saved it in the functions folder. This file saves as the controller.
You can add more functions inside this file. Copy the code below.
18. Go back to the student file under the objects folder. Add this code below:
19. Open any browser and type this URL to the address bar to run the program:
localhost/gadtc-enrollment/add_student.php
20. Open the student table and check if it is saved.

Output submission:

Place it in a word document and upload it from the link provided.


Content must include the following:

1. Write your name, your Course and Year at the header of the document.
2. Your code to every php file.
3. Screenshot of the database creation from the DBMS program (ex: SQLYog, Navicat, phpMyAdmin, etc.)
4. Screenshots of the of the output during run time.
5. Picture of you working in a computer with a timestamp.

Note: No copying of work. You can add another field in the program like: year, gender, birthday etc.

You might also like