Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
319 views

PHP and MySQL PDF

The document outlines objectives and topics for a course module on web development using PHP and MySQL. The module will teach students to: 1) understand MySQL functionality and phpMyAdmin; 2) create PHP scripts to connect to and close MySQL connections; 3) build web applications that can pass data, add/update/delete records, and populate option lists from a database; and 4) create a login page to validate users. It provides examples of opening and closing PHP-MySQL connections and references additional learning resources.

Uploaded by

benalyn ignacio
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
319 views

PHP and MySQL PDF

The document outlines objectives and topics for a course module on web development using PHP and MySQL. The module will teach students to: 1) understand MySQL functionality and phpMyAdmin; 2) create PHP scripts to connect to and close MySQL connections; 3) build web applications that can pass data, add/update/delete records, and populate option lists from a database; and 4) create a login page to validate users. It provides examples of opening and closing PHP-MySQL connections and references additional learning resources.

Uploaded by

benalyn ignacio
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Web Development

1
PHP and MYSQL

PHP and MYSQL


Objectives:

At the end of the module the student is expected to:

1. Understand the meaning of MYSQL and its functionalities


2. Understand the application of phpmyadmin.
3. Create php connection script to mysql and close
4. Create web applications that could
a. Pass data
b. Add row
c. Change / update data
d. Delete records
e. Populate data in option list
f. Create a login in page to validate users from the database

PHP Connect to MySQL

PHP 5 and later can work with a MySQL database using:


 MySQLi extension (the "i" stands for improved)
 PDO (PHP Data Objects)

Open a Connection to MySQL


<?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

Course Module
Close the Connection
The connection will be closed automatically when the script ends. To
close the connection before, use the following:
$conn->close();

Connecting to database
Web Development
3
PHP and MYSQL

Course Module
Passing data
Web Development
5
PHP and MYSQL

Course Module
Adding row
Web Development
7
PHP and MYSQL

Course Module
Web Development
9
PHP and MYSQL

Deleting rows

Course Module
Web Development
11
PHP and MYSQL

Changing data

Course Module
Web Development
13
PHP and MYSQL

Course Module
Populate option list
Web Development
15
PHP and MYSQL

Login validation

Course Module
Web Development
17
PHP and MYSQL

References
Murach, J. (2014) Murach’s PHP and MYSQL (2nd Edition)

Yank, K, PHP and MYSQL: Novice to Ninja

WEBSITE
http://php.net/

http://www.w3schools.com/php/

https://www.tutorialspoint.com/php/

Course Module

You might also like