Laboratory Exercise 7 Bondoc
Laboratory Exercise 7 Bondoc
LABORATORY EXERCISE
____ SEMESTER: AY: _________
LABORATORY EXERCISE 7
GUI: USER FORM (INSERT, DELETE, UPDATE, AND SEARCH/QUERY)
Learning Objectives
To demonstrate the SQL statement in PL, such as Visual Studio / Java.
To visualize and understand the role of the SQL statement in the Programming
Languages.
To determine what SQL script used in implementing in User Form.
Background
SQL (Structured Query Language) is a nonprocedural language, and you specify what
you want, not how to get it. A block-structured format of English keywords uses in this Query
language. It has the following components. The SQL DDL (Data Definition Language) provides a
command for defining relation schemas, deleting relations, and modifying relation schema.
DML (Data Manipulation Language) includes commands to insert tuples into, delete tuples
from and modify tuples in the Database. Embedded and Dynamic SQL define how SQL
statements can embed within general-purpose programming languages, such as C, C++, JAVA,
COBOL, Pascal, and Fortran.
Materials/Resources
PC/Internet
Pen
Programming Application (Visual Studio, Netbeans)
MySQL (Xampp, Wampp & MySQL)
Web Browser (Internet Explorer, Mozilla, Google Chrome, Etc.)
Word-processing program
Laboratory Activity
Instructions: Perform the following steps.
1. Open the program Xampp
2. Click the Start for Apache and MySQL
3. Then, click MySQL Admin
4. Select Database, then click the Database created on laboratory exercise 1/2
5. Then, open your program in Laboratory Exercise 6
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
QUESTIONS
1. What parts of the process in developing the laboratory exercise 7 give you a problem?
Why?
- Honestly, I just used my CRUD activity in web system and technology subject. But in
my experience in making the CRUD activity, the part that gives me a problem was
the function that calls the data from the database to display it in the table and my
error was more on about the database connection.
<div class="container">
<br>
<br>
INSERT
</button>
<br>
<br>
<div class="modal-content">
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
<div class="modal-header">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Username</label>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Password</label>
</div>
</form>
</div>
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
</div>
</div>
</div>
<table class="table">
<thead class="table-success">
<tr>
<th scope="col">Name</th>
<th scope="col">Password</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr>
</tr>
<?php } ?>
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
</tbody>
</table>
</body>
</html>
<?php $this->load->view('includes/header');?>
<div class="container">
<br>
<br>
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
</div>
<div class="form-group">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Password</label>
</div>
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
</form>
</div>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>USER FORM</title>
</head>
<body>
</form>
</nav>
CONTROLLERS
<?php
parent:: __construct();
$this->load->model('User_model');
}
$data['result'] = $this->User_model->getAllData();
$this->load->view('User_form', $data);
}
$this->User_model->createData();
redirect("User_controller");
}
$data['row'] = $this->User_model->getData($User_ID);
$this->load->view('User_edit', $data);
}
$this->User_model->updateData($User_ID);
redirect("User_controller");
}
$this->User_model->deleteData($User_ID);
redirect("User_controller");
}
}
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
MODELS
<?php
$this->load->database();
}
function createData() {
$data = array (
);
$this->db->insert('users', $data);
}
/* gets all the input data from the database and print */
function getAllData() {
return $query->result();
}
function getData($User_ID) {
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
return $query->row();
}
function updateData($User_ID) {
$data = array (
);
$this->db->where('User_ID', $User_ID);
$this->db->update('users', $data);
}
function deleteData($User_ID) {
$this->db->where('User_ID', $User_ID);
$this->db->delete('users');
}
}
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
Output / Results
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
____ SEMESTER: AY: _________
Conclusion
- Basically, this activity was similar to CRUD implementation. CRUD is the acronym of create,
read, update and delete. So, this activity has the insert, delete, edit, save, and exit and it
is very similar. This activity is about on how to integrate the database to the form
using php syntax.