Matthew M.

Matthew M.

Creating Databases & Tables

Slide Duration:

Table of Contents

Section 1: Advanced PHP with MySQL
Course Introduction

13m 36s

Intro
0:00
Advanced PHP w/ MySQL
0:13
Course Introduction
0:14
Course Content
0:59
Web Application: Educator Store
1:45
Web Application: Educator Store
1:46
Object-Oriented Programming
6:09
Object-Oriented Programming Overview
6:10
MySQL
6:50
MySQL Overview
6:51
Example: Command Prompt & MySQL
8:34
What You Will Learn
9:34
What You Will Learn
9:35
Course Prerequisites
11:52
Course Prerequisites
11:53
Advanced Course Development Environment

18m 46s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
Development Environment Setup
1:36
Firefox Web Browser, XAMPP, and PSPad Text Editor
1:37
Course Directory Structure
4:36
Course Directory Structure
4:37
phpDocumentor
7:23
phpDocumentor Overview
7:24
Parsing Source Code
7:44
docs Subdirectory
9:06
Asvanced PHP Course Documentation Example
10:21
Previous Educator PHP Students
14:14
Lib Directory Changes
14:38
Images Directory Changes
14:57
VERSION Constant
15:40
Comments Noting a Specific Version Number
17:04
Homework Challenge
17:30
Homework Challenge
17:31
Introduction to File I/O

35m 37s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
File I/O
1:34
File I/O Overview
1:35
Performing file I/O: 3 Steps
1:52
File Permissions
2:28
Read Permission & Write Permission
2:29
fopen()
4:47
fopen()
4:48
Two Required Parameters
5:01
Successful fopen(): File Handle and Resource
5:21
FALSE and E_WARNING Error
6:00
Example
6:39
File Paths
7:10
File Paths
7:11
File Access Modes
9:18
File Access Modes
9:19
Coding Example: fopen()
10:31
Using Relative and Absolute Path & Non-Existent File
10:32
File Pointers
15:55
File Pointers
15:56
Example File
16:11
Opening a File with fopen() Using 'r' as the Access Mode
16:22
fgets()
17:55
fgets() Overview
17:56
Coding Example: fgets() - Reading a Line at a Time
18:26
feof()
20:10
feof() Overview
20:09
Coding Example: feof()
20:50
fclose()
23:43
fclose() Overview
23:44
Coding Example: fclose()
25:02
Coding Example: Current Stock
26:10
Coding Example: Current Stock
26:11
trim ()
31:39
trim () Overview and Example
31:40
Homework Challenge
33:35
Homework Challenge
33:36
Web Application Development

36m 36s

Intro
0:00
Lesson Overview
0:16
Lesson Overview
0:17
Version 1.0 Changelog
0:31
catalog.php
0:32
Function Library: fileLIB.php
5:00
Version 1.1 Changelog
27:12
createItemDataArray() and createDeptDataArray()
27:13
outputSimpleItemLink() and outputSimpleDeptLink()
32:06
HTTP & the POST Method

34m 36s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
HTTP Model
1:28
HTTP Model
1:29
Client-Server Model 2 Steps Process
2:00
HTTP Messages
2:23
HTTP Messages
2:24
HTTP Requests
3:09
HTTP Requests
3:10
Example: HTTP Request Header
3:17
Coding Example: HTTP Requests
4:29
HTTP Responses
7:15
HTTP Responses
7:16
Example: HTTP Response (Header & Body)
8:00
header()
11:47
header() Overview
11:48
Coding Example: header
14:02
Coding Example: header() Error
14:52
GET Method
18:55
GET Method
18:56
Coding Example: GET Method
20:13
POST Method
21:09
POST Method
21:10
Coding Example: Sample Form Using the POST Method
23:50
Accessing POST Data in PHP
26:38
Accessing POST Data in PHP
26:39
Coding Example: Accessing POST Data via $_POST
28:15
GET vs. POST
29:54
GET vs. POST
29:55
Example: Accessing POST Data via $_POST
31:20
Example: Accessing POST Data via $_POST
31:21
Homework Challenge
33:00
Homework Challenge
33:01
Web Application Development

14m 11s

Intro
0:00
Version 2.0 Changelog
0:09
Updating the Site's Current Form to Use the POST Method
0:10
Creating Admin Website
2:55
Dynamically Generated Department List
12:40
Writing to Files

17m 38s

Intro
0:00
Lesson Overview
0:09
Lesson Overview
0:10
Review of File I/O
0:40
Review of File I/O
0:41
fwrite()
1:38
fwrite()
1:39
fputs()
2:20
'r+'
2:31
Coding Example: fwrite()
2:59
fopen() Access Modes
8:41
'a' and 'a+'
8:42
'w' and 'w+'
11:34
Homework Challenge
14:47
Homework Challenge
14:48
Web Application Development

28m 14s

Intro
0:00
Lesson Overview
0:08
Lesson Overview
0:09
Updated Open File Functions
0:19
openItemsDataFile ( ), openDeptsDataFile ( ), and openLastAddedFile ( )
0:20
insertItem()
6:25
insertItem() Overview
6:26
Functions: createItemDataString ( ) and updateLastItemAdded ( )
7:07
addItemToDepartment ()
16:03
addItemToDepartment () Overview
16:04
Functions: createDeptDataString ( ) and updateDepartment ( )
17:55
HTTP POST: File Uploads

22m 51s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
POST Data Encoding
1:13
POST Data Encoding
1:14
When Data is Included in the Body of the HTTP POST Request and is of the Content Type
1:31
When Uploading Files Using HTTP POST
3:17
Uploading Files
6:22
Uploading Files
6:23
If Encoding Type is Not Set to Multipart/Formdata
9:27
$_FILES Superglobal
10:59
$_FILES Superglobal
11:00
Structure of $_FILES
12:15
Structure of $_FILES: Name, Type, tmp_name, Error, and Size
12:16
Coding Example: $_FILES Superglobal
13:34
Moving an Uploaded File
15:39
Introduction to Moving an Uploaded File
15:40
move_uploaded_file ( ): Definition and Example
16:40
Homework Challenge
21:19
Homework Challenge
21:20
Web Application Development

15m 30s

Intro
0:00
Lesson Overview
0:09
Lesson Overview
0:10
Uploading Item Image File
1:22
Uploading Item Image File
1:23
Uploading Item Image File (cont.)
2:43
Altering insertItem ( )
2:44
Helpfer Functions: getFileExtension ( ) and moveUploadedFile ( )
4:30
isValidItem ( )
13:03
Introduction to Object-Oriented Programming

32m 44s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
Object-Oriented Programming
0:56
Introduction to Object-Oriented Programming
0:57
Associative Arrays
5:27
Associative Arrays
5:28
Classes
7:27
Classes Overview
7:28
Defining Classes
8:24
Defining Classes
8:25
Declaring Class Properties
9:25
Coding Example: Classes
10:11
Objects
12:18
Objects Overview
12:19
Classes vs. Objects
12:49
Classes vs. Objects
12:50
Instantiating Classes
14:58
Instantiating Classes
14:59
Coding Example: Instantiate an Item Object
16:30
Object Properties
19:21
Access and Set an Object's Property
19:22
Coding Example: Set & Access the Properties of an Item Object
24:23
Homework Challenge
30:22
Homework Challenge
30:23
Web Application Development

17m 47s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
Version 5.0 Overview
0:50
Version 5.0 Overview and Examples
0:51
Outputting Object Properties
12:38
Outputting Object Properties
12:39
Array Object Properties
14:18
Access and Set Array Value
14:19
Object Methods

39m 57s

Intro
0:00
Lesson Overview
0:12
Lesson Overview
0:13
Object Methods
0:52
Definition of Object Methods
0:53
Calling Object Methods
3:25
Calling Object Methods
3:26
Coding Example: Simple Object Methods
4:44
Object Methods and Return Values
7:02
$this Variable
10:06
$this Variable: Definition and Example
10:07
$this Variable (cont.)
15:51
$this Variable (cont.)
15:52
Getters & Setters
21:21
Getters & Setters Methods
21:22
Object Methods In Strings
25:46
Object Methods In Strings
25:47
Coding Example: Outputting Method Return Values in Strings
27:41
Using $this to Call Other Methods
28:49
Using $this to Call Other Methods
28:50
Homework Challenge
34:18
Homework Challenge: 1-3
34:19
Homework Challenge (cont.)
36:20
Homework Challenge: 4-6
36:21
Homework Challenge (cont.)
37:52
Homework Challenge: 7-10
37:53
Web Application Development

17m 30s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
Version 6.0 Overview
0:40
Version 6.0 Changes & Examples
0:41
Item Methods
0:53
Item Class Definition: getImageFilename()
0:54
Coding Example: getImageFilename()
1:58
Department Methods
7:33
addItem(), removeItem(), and isItemInDept() Method
7:34
addItemtToDepartment() & buildDeptObject() Functions
11:46
A Default Value Needed to Be Set for $items
16:26
Object Constructors

22m 20s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
Object Constructors
0:32
Introduction to Object Constructors
0:33
Coding Example: Object Constructors
1:43
Defining Constructors
3:26
Defining Constructors
3:27
Coding Example: Constructors with No Arguments
4:24
Constructor Arguments
8:09
Constructor Arguments
8:10
Coding Example: Constructor Arguments
9:49
Important Notes
16:13
Important Notes
16:14
Homework Challenge
17:35
Homework Challenge: 1 - 4
17:36
Homework Challenge (cont.)
19:13
Homework Challenge: 5 - 9
19:14
Homework Challenge (cont.)
21:40
Homework Challenge: 10 and 11
21:41
Web Application Development

16m 19s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
Version 7.0 Overview
0:39
Version 7.0 Overview
0:40
Item Constructor
2:19
Item Constructor
2:20
Department Constructor
7:47
Department Constructor
7:48
Customer Constructor
12:23
Customer Constructor
12:24
More Magic Methods

53m 37s

Intro
0:00
Lesson Overview
0:13
Lesson Overview
0:14
Magic Methods
1:12
Magic Methods
1:13
Destructors
2:45
Destructors Overview
2:46
Coding Example: Calling Destructors
4:30
Coding Example: Object Destructor
9:19
_to String ()
16:12
_to String () Overview
16:13
Coding Example: _to String () Magic Method
18:10
Access Modifiers
21:23
Introduction to Access Modifiers
21:24
Access Modifiers: Public
21:39
Access Modifiers: Private
22:18
Access Modifiers: Protected
22:41
Object Properties and Methods
23:06
Coding Example: Public Access Modifiers
26:48
Coding Example: Private Access Modifiers
28:30
_get()
31:37
_get() Overview
31:38
Coding Example: _get () Magic Method
33:30
_set ()
36:23
_set () & the Magic Method
36:24
Using Getters & Setters
44:37
Coding Example: Using Getters & Setters
44:38
Homework Challenge
50:33
Homework Challenge: 1 - 6
50:34
Homework Challenge (cont.)
51:41
Homework Challenge: 7 - 12
51:42
Web Application Development

31m 12s

Intro
0:00
Version 8.0 Review
0:12
Version 8.0 Review
0:13
private Object Properties
1:15
private Object Properties
1:16
Coding Example
2:54
_toString() Methods
6:51
_toString() Methods
6:52
Coding Example
8:09
DataFile Class
13:27
DataFile Class & I/O Operations
13:28
Using DataFile Class: Instantiate a DataFile, DataFile open () Method, and DataFile close () Method
18:09
Homework Challenge
29:35
Homework Challenge
29:36
Classes vs. Objects

37m 49s

Intro
0:00
Lesson Overview
0:09
Lesson Overview
0:10
Class vs. Object Review
0:58
Class vs. Object Review
0:59
Static Properties
2:42
Static Properties
2:43
Scope Resolution Operator (::)
5:26
Scope Resolution Operator (::) & Static Property
5:27
Coding Example: Accessing a Static Property Using the Scope Resolution Operator
7:57
Coding Example: Accessing a Static Property in a Class Definition
10:33
Coding Example: Using a Static Property as an Instance Counter
14:18
Static Methods
18:51
Static Methods Overview
18:52
Coding Example: Static Methods
21:39
Classes vs. Objects
26:28
Classes vs. Objects: Diagrams
26:29
Class Constants
30:24
Class Constants Definition
30:25
Coding Example: Using Class Constants
31:55
Homework Challenge
34:01
Homework Challenge: 1 - 5
34:02
Homework Challenge (cont.)
35:25
Homework Challenge: 6 - 10
35:26
Web Application Development

21m 7s

Intro
0:00
Version 9.0 Overview
0:12
Version 9.0 Changes & Examples
0:13
Output Class
1:08
Output Class & Static Methods
1:09
outputHtmlSelector ( ) Method
2:43
outputItemSelector ( ) Method
4:53
outputDeptSelector ( ) Method
6:42
buildObject() Methods
11:54
buildObject() Methods & Examples
11:55
Exceptions

22m 43s

Intro
0:00
Lesson Overview
0:12
Lesson Overview
0:13
try Blocks
0:44
try Blocks Definition
0:45
catch Blocks
2:03
catch Blocks: Definition and Syntax
2:04
Coding Example: try/catch Blocks
3:48
When an Exception Object is Caught & Error Handling
5:59
Exception Class
7:02
Exception Class
7:03
Coding Example: Using try/catch to Catch an Exception Thrown from a Method
8:04
Re-Throwing Exceptions
16:39
Re-Throwing Exceptions
16:40
Coding Example: Re-throwing an Exception
17:21
Homework Challenge
20:40
Homework Challenge: 1 - 5
20:41
Homework Challenge (cont.)
22:17
Homework Challenge: 6
22:18
Web Application Development

22m

Intro
0:00
Version 10.0 Overview
0:11
Updating addItem.php, addItemToDept.php, and error.php
0:12
Updating DataFile Class: open ( ) Method & try/catch blocks
7:45
Version 10.1 Overview
13:37
Version 10.1 Changes & Examples
13:38
Updating DataFile Class: close ( ) Method & logWarning ( )
20:17
Cookies

39m 47s

Intro
0:00
Lesson Overview
0:09
Lesson Overview
0:10
What is a Cookie?
1:15
Definition of Cookie
1:16
HTTP - A Stateless Protocol
2:17
HTTP - A Stateless Protocol
2:18
Purpose of Cookies
4:10
Set - Cookie Header
6:21
Introduction to Set - Cookie Header
6:22
Coding Example: Set - Cookie Header
7:38
Cookie Header
9:45
Introduction to Cookie Header
9:46
Example: Cookie Header
10:27
setcookie()
12:33
Introduction to setcookie()
12:34
Example: Using setcookie
13:54
Cookies Attributes
15:48
Cookies Attributes Overview
15:49
Common Cookies Attributes: Domain
16:24
Common Cookies Attributes: Path
17:04
Common Cookies Attributes: Expires
19:34
Coding Example: Setting Cookie Attributes
20:58
$_COOKIE Superglobal
27:03
$_COOKIE Superglobal
27:04
Coding Example: Accessing Cookies from PHP Using $_COOKIE
29:45
Security Implications
34:44
Security Implications
34:45
Homework Challenge
36:10
Homework Challenge: 1 - 4
36:11
Homework Challenge (cont.)
37:47
Homework Challenge: 5 - 7
37:48
Web Application Development

39m 11s

Intro
0:00
Lesson Overview
0:17
Lesson Overview
0:18
instanceof Operator
1:34
instanceof Operator
1:35
Objects with Object Properties
2:53
Objects with Object Properties
2:54
Version 11.0 Overview
6:41
Version 11.0 Changes: Cart and CartItem Classes
6:42
Version 11.0 Coding Example
10:40
Version 11.1 Overview
31:03
Version 11.1 Changes & Examples
31:04
Introduction to Sessions

46m 8s

Intro
0:00
Lesson Overview
0:08
Lesson Overview
0:09
What is a Session?
0:53
What is a Session?
0:54
Client-Side Sessions
3:51
Client-Side Sessions
3:52
Server-Side Sessions
5:04
Server-Side Sessions
5:05
Session IDs
6:26
Session IDs
6:27
The SID is Used by the Server to:
7:08
A Client Passes an SID to the Server with Each HTTP Request Via:
8:15
Sessions in PHP
12:19
Sessions in PHP
12:20
session_start()
14:40
session_start() Overview
14:41
Coding Example: Using session_start () to Continue a Session
18:03
$_SESSION Superglobal
22:06
$_SESSION Superglobal Overview
22:07
Coding Example: Setting a Session Variable via $_SESSION
25:22
Accessing Session Data
28:08
Accessing Session Data
28:09
Deleting Session Data
31:43
Deleting Session Data
31:44
Coding Example: Deleting Session Data
32:16
Configuring PHP Sessions
36:14
session.cookie_lifetime, session.cookie_domain, and session.cookie_path
36:15
Coding Example: Configuring PHP Sessions
37:28
Configuring PHP Sessions (cont.)
40:56
session.use_cookies, session.use_trans_sid, and session.use_only_cookies
40:57
Coding Example: Configuring PHP Sessions
42:25
Homework Challenge
42:55
Homework Challenge: 1 - 5
42:56
Homework Challenge (cont.)
44:10
Homework Challenge: 6 - 10
44:11
Homework Challenge (cont.)
45:27
Homework Challenge: 11 - 13
45:28
Web Application Development

11m

Intro
0:00
Version 12.0 Overview
0:12
Version 12.0 Changes Part I: Updating 'viewCart.php' & 'checkout.php'
0:13
Version 12.0 Changes Part II
5:03
Destroying Sessions

29m 59s

Intro
0:00
Lesson Overview
0:12
Lesson Overview
0:13
Destroying Sessions
1:02
Destroying Sessions
1:03
session_destroy()
2:10
session_destroy() Overview
2:11
Coding Example: Setting a Session Variable and Destroying a Session
3:18
Deleting Session Cookies
8:38
Deleting Session Cookies
8:39
Coding example: Deleting Session Cookies
9:17
Review of Steps
21:07
Review of Steps
21:08
Garbage Collection
21:50
Garbage Collection Overview
21:51
Coding Example: Garbage Collection
24:30
Homework Challenge
26:28
Homework Challenge: 1 - 4
26:29
Homework Challenge (cont.)
28:16
Homework Challenge: 5 - 9
28:17
Web Application Development

19m 14s

Intro
0:00
Lesson Overview
0:13
Lesson Overview
0:14
_autoload()
0:46
Introduction to _autoload ()
0:47
Version 13.0 Overview
4:06
_autoload () and SessionManager Class
4:07
Updating 'viewCart.php' & 'checkout.php'
11:16
Introduction to Databases

21m 24s

Intro
0:00
Lesson Overview
0:16
Lesson Overview
0:17
Flat Files
1:09
Flat Files: Definition and Example
1:10
Problems Associated with Using Flat Files as a Database
2:15
Relational Databases
3:29
Relational Databases
3:30
Relational Database Management System (RDBMS)
3:50
Tables
7:43
Tables
7:44
Columns
9:24
Columns
9:25
What is SQL?
10:45
Introduction to Structured Query Language
10:46
Standard Data Types of SQL
12:23
Primary Keys
13:19
Primary Keys
13:20
Primary Key Examples
16:36
Primary Key Examples
16:37
Introduction to MySQL

28m 11s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
What is MySQL?
1:33
MySQL
1:34
MySQL Monitor
5:16
MySQL Monitor Overview
5:17
XAMPP & MySQL
5:58
In the MySQL Command: hostname, username and -p
7:05
Connecting to a MySQl Server
9:52
Connecting to a MySQl Server
9:53
Using MySQl Monitor
13:48
Using MySQl Monitor
13:49
GRANT Command
15:10
GRANT SQL Command
15:11
Privileges & Objects
18:18
Username, Hostname, and Password
19:37
Specifying Objects
20:05
Creating a PHP User Account
21:41
Creating a PHP User Account Overview
21:42
Meaning of all & *.*
23:35
Example: Creating a PHP User Account
23:48
Required Homework
26:27
Required Homework: 1 - 5
26:28
Required Homework (cont.)
27:28
Required Homework: 6
27:29
Creating Databases & Tables

23m 1s

Intro
0:00
Lesson Overview
0:08
Lesson Overview
0:09
Creating a Database
1:40
Introduction to Creating a Database
1:41
Example: Creating a Database
3:33
CREATE TABLE Command
6:43
CREATE TABLE Command
6:44
Data Types
7:39
Numeric Data Types: INT, INT UNSIGNED, and DECIMAL
7:40
String Data Types: CHAR (M), VARCHAR (M), and TEXT
9:23
Colum Attributes
11:00
PRIMARY KEY Attribute
11:01
AUTO INCREMENT Attribute
11:35
Items Table
13:07
Items Table
13:08
Useful Commands
17:04
SHOW TABLES Command & DESCRIBE Utility Statement
17:05
Example: Creating an Items Table
17:58
Required Homework
20:51
Required Homework: 1 - 6
20:52
Required Homework (cont.)
21:55
Required Homework: 7 - 9
21:56
SQL Command: INSERT

27m 11s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
INSERT Command
1:20
SQL INSERT Command
1:21
Specifying Values
3:16
Columns with Numeric Data Types
3:17
Columns with String Data Types
3:34
Columns with AUTO INCREMENT
4:07
Inserting Items
5:21
Inserting Items
5:22
Example: Inserting Items
7:03
SQL Text Files
14:04
SQL Monitor Client
14:05
MySQL Monitor & the < Operator
15:15
Example
17:35
Required Homework
22:32
Required Homework: 1 - 6
22:33
Required Homework (cont.)
24:19
Required Homework: 7 - 10
24:20
SQL Command: SELECT

24m 57s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
SELECT Command
0:42
SELECT Command: Definition and Syntax
0:43
Results of a SELECT Query
1:53
To Specify the Retrieval of All Columns from a Table
3:06
Example: SELECT Command
4:18
WHERE Clause
7:11
WHERE Clause
7:12
A SELECT Query with WHERE Clause has the Following Syntax
8:10
A Where Condition can Contain both Logical and Comparison Operators
9:44
Literal Values
13:24
Literal Values
13:25
Example: Literal Values
14:18
ORDER BY Clause
15:31
ORDER BY Clause & SELECT Query
15:32
Ascending and Descending Order
17:30
An ORDER BY Clause can Specify Multiple Columns to Order the Rows by
18:01
Example: SELECT Query with WHERE and ORDER BY Clause
20:32
Homework Challenge
21:59
Homework Challenge
22:00
Homework Challenge (cont.)
23:54
Homework Challenge
23:55
Using PHP from MySQL

32m 43s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
PHP/MySQL Architecture
0:56
PHP/MySQL Architecture
0:57
MySQLi Extension
3:05
MySQLi Extension
3:06
Steps to Using MySQL from PHP
5:53
Four Steps to Using MySQL from PHP
5:54
Step # 3
7:18
Connecting to a Database
8:12
To Connect to a MySQL Database
8:13
To Test for Connection Errors
10:20
Running an SQL Statement
11:54
Running an SQL Statement
11:55
Example
13:30
Processing the Results
15:58
For non-SELECT Queries
15:59
MySQLi Object Property: affected_rows
16:19
For INSERT Statements on Tables with an AUTO_INCREMENT Column
18:07
Closing the Connection
19:45
Closing the Connection
19:46
Coding Example
21:24
Coding Example: Using MySQL from PHP
21:25
Homework Challenge
29:00
Homework Challenge: 1 - 4
29:01
Homework Challenge (cont.)
31:10
Homework Challenge: 5 - 9
31:11
Web Application Development

30m 30s

Intro
0:00
Lesson Overview
0:14
Lesson Overview
0:15
sprintf()
1:28
sprintf() Overview
1:29
Example
1:56
INSERT Statements with sprintf()
5:15
INSERT Statements with sprintf()
5:16
Version 14.0 Overview
10:00
Version 14.0 Changes & Examples Part 1
10:01
Version 14.0 Changes & Examples Part 2
21:58
SELECT QUERIES from PHP

24m 22s

Intro
0:00
Lesson Overview
0:14
Lesson Overview
0:15
SELECT Queries
1:21
SELECT Queries
1:22
MySQLi_Result Class
3:17
MySQLi_Result Class: num_rows
3:18
MySQLi_Result Class: fetch_assoc ( ) and fetch_object ( )
3:59
fetch_assoc()
5:17
fetch_assoc() Overview
5:18
Coding Example: Using fetch_assoc()
9:00
stdClass Objects
12:46
stdClass Objects
12:47
fetch_object()
14:19
fetch_object() Overview
14:20
Coding Example: Using fetch_object()
16:45
Freeing Result Set Memory
18:42
Freeing Result Set Memory
18:43
Coding Example: Using free ( )
20:01
Homework Challenge
22:07
Homework Challenge: 1 - 5
22:08
Web Application Development

17m 6s

Intro
0:00
Version 15.0 Overview
0:13
Version 15.0 Changes & Examples Part 1
0:14
Version 15.0 Changes & Examples Part 2
8:43
Linking Tables

24m 32s

Intro
0:00
Lesson Overview
0:16
Lesson Overview
0:17
A Departments Table
1:08
Departments Table
1:09
How Could We Model This in a Table: Option 1
1:26
How Could We Model This in a Table: Option 2
3:12
Database Normalization
4:37
Database Normalization
4:38
Foreign Keys
8:47
Foreign Keys
8:48
Linking Table
11:26
Linking Table
11:27
Multiple Column Primary Keys
15:30
Multiple Column Primary Keys
15:31
Example
18:51
Required Homework
22:34
Required Homework: 1 - 3
22:35
Required Homework (cont.)
24:10
Required Homework: 4
24:11
Web Application Development

24m

Intro
0:00
Version 16.0 Overview
0:11
Version 16.0 Changes
0:12
Version 16.0 Coding Examples
4:12
Version 16.0 (cont.)
18:30
Version 16.0 Changes & Examples Part 2
18:31
SQL Command: DELETE

10m 33s

Intro
0:00
Lesson Overview
0:12
Lesson Overview
0:13
DELETE Statement
0:30
DELETE Statement & Its WHERE Clause
0:31
Delete All Rows From a Table
2:57
Using DELETE from PHP
4:04
Using DELETE from PHP Overview
4:05
Coding Example: Using DELETE from PHP
6:37
Homework Challenge
8:53
Homework Challenge: 1 - 4
8:54
Web Application Development

16m 2s

Intro
0:00
Version 17.0 Overview
0:11
Version 17.0 Changes
0:12
Version 17.0 Coding Example
2:51
Transactions
12:50
Database Transaction
12:51
Steps in Using Transactions
14:00
SQL Command: UPDATE

32m 14s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
UPDATE Statement
0:54
UPDATE Statement & Its WHERE Clause
0:55
Example: UPDATE Statement
3:32
Using UPDATE from PHP
5:21
Using UPDATE from PHP Overview
5:22
Coding Example: Using UPDATE from PHP
6:53
htmlspecialchars()
9:04
htmlspecialchars()
9:05
Encoding Special Characters
9:23
Coding Example: htmlspecialchars()
13:41
addslashes()
20:40
addslashes()
20:41
Coding Example: addslashes()
22:52
Homework Challenge
27:55
Homework Challenge: 1 - 2
27:56
Homework Challenge (cont.)
30:14
Homework Challenge: 3 - 5
30:15
Homework Challenge (cont.)
30:41
Homework Challenge: 6 - 9
30:42
Web Application Development

12m 33s

Intro
0:00
Version 18.0 Overview
0:12
Version 18.0 Changes
0:13
Version 18.0 Coding Example
1:24
SQL: Joins

42m 16s

Intro
0:00
Lesson Overview
0:11
Lesson Overview
0:12
DATETIME Data Type
1:52
DATETIME Data Type
1:53
Modeling Orders
5:12
Modeling Orders
5:13
Customers Table
10:46
Customers Table
10:47
Example
16:18
Example: Order Table in MySQL
16:19
Joins
22:26
Joins Overview
22:27
Inner Join
23:09
Example: Joins
24:11
Join Conditions
28:14
Join Conditions
28:15
Example
28:32
Join Queries
30:00
Example: Join Conditions in MySQL
30:36
Implicit Joins
34:42
Implicit Joins
34:43
Example: Implicit Joins
35:57
Aliases
37:28
Introduction to Aliases
37:29
Example: Aliases
38:55
Required Homework
40:32
Problem 1
40:33
Problem 2
41:01
Problem 3
41:17
Web Application Development

29m 34s

Intro
0:00
Lesson Overview
0:12
Lesson Overview
0:13
Inserting Orders
0:44
Inserting Orders
0:45
Version 19.0 Overview
3:45
Version 19.0 Changes & Example Part 1
3:46
Version 19.0 Changes & Example Part 2
13:18
Version 19.1 Overview
21:10
Version 19.1 Changes
21:11
Version 19.1 Coding Example
22:18
User Authentication

26m 13s

Intro
0:00
Lesson Overview
0:10
Lesson Overview
0:11
User Authentication
1:31
User Authentication
1:32
Authentication with Sessions
2:34
Authentication with Sessions
2:35
Four Steps in Authentication via Sessions
2:50
Using Sessions to Restrict Access
3:58
Using Sessions to Restrict Access
3:59
Coding Example: Restricted Access Area
4:47
Authentication Methods
5:54
Authentication Methods Overview
5:55
Coding Example: Authentication Methods
7:31
Logging Out
9:57
Logging Out
9:58
Coding Example: Log Out
10:47
Users Table
13:50
Users Table
13:51
Example: Creating a Users Table
15:08
Password Hashing
17:30
Password Hashing
17:31
PHP and MySQL Built-in Hash Functions: sha1 ( ) and md5 ( )
18:43
Coding Example: Password Hashing
19:27
Required Homework
24:41
Required Homework: 1 - 4
24:42
Web Application Development

14m 36s

Intro
0:00
Version 20.0 Overview
0:13
Version 20.0 Changes & Examples Part 1
0:14
Version 20.0 Changes & Examples Part 2
5:05
Version 20.0 Changes & Examples Part 3
7:29
Version 20.0 (cont.)
8:31
Version 20.0 Changes & Examples Part 4
8:32
Loading...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Advanced PHP
Bookmark & Share Embed

Share this knowledge with your friends!

Copy & Paste this embed code into your website’s HTML

Please ensure that your website editor is in text mode when you paste the code.
(In Wordpress, the mode button is on the top right corner.)
  ×
  • - Allow users to view the embedded video in full-size.
Since this lesson is not free, only the preview will appear on your website.
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Transcription

  • Related Services

Lecture Comments (4)

1 answer

Last reply by: Charles Noel
Sat Dec 1, 2012 2:16 PM

Post by Charles Noel on December 1, 2012

For some reasons I created the table items without entering price, description and imageFileExt. Is there any way I can insert them? Thanks..

1 answer

Last reply by: Matthew M.
Wed Apr 11, 2012 4:13 PM

Post by Jesus Fernandez on April 1, 2012

I can get to the proper command prompt, however it does not execute any of the commands in your video.

Creating Databases & Tables

  • A database is created using the CREATE DATABASE SQL command:
    CREATE DATABASE dbName;
  • MySQL provides the following non-SQL commands:
    • SHOW DATABASES – lists all of the databases on a MySQL server
    • USE – selects a particular database on a MySQL server to use and to apply future commands to
  • SQL defines the CREATE TABLE command for creating database tables. It accepts a comma-delimited list of column definitions between parentheses and has the following syntax:
    CREATE TABLE tblName
    (
    colName1 dataType1 colAttr1,
    colName2 dataType2 colAttr2,
    );
  • SQL Numeric Data Types:
    • INT – integer data type
    • INT UNSIGNED – positive integer data type
    • DECIMAL(M, D) – floating point number with M digits, D digits after the decimal point
  • SQL String Data Types:
    • CHAR(M) – fixed-length string of M characters
    • VARCHAR(M) – variable-length string up to M characters in length
    • TEXT – large amounts of string data
  • Each column in a table can have attributes set that affect the functionality of the column.
  • The PRIMARY KEY attribute denotes a column as the primary key for the table.
    • Only one column can have the PRIMARY KEY attribute.
  • The AUTO_INCREMENT attribute denotes that MySQL should automatically generate the value for the column for each row by incrementing the largest column value at the time a row is inserted by one.
    • This only can apply to integer or floating-point columns
  • The SHOW TABLES command can be used to list all of the tables in a particular database.
  • The DESCRIBE utility statement can be used to see the structure of a table.
  • Additional Resources:

Creating Databases & Tables

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Lesson Overview 0:08
    • Lesson Overview
  • Creating a Database 1:40
    • Introduction to Creating a Database
    • Example: Creating a Database
  • CREATE TABLE Command 6:43
    • CREATE TABLE Command
  • Data Types 7:39
    • Numeric Data Types: INT, INT UNSIGNED, and DECIMAL
    • String Data Types: CHAR (M), VARCHAR (M), and TEXT
  • Colum Attributes 11:00
    • PRIMARY KEY Attribute
    • AUTO INCREMENT Attribute
  • Items Table 13:07
    • Items Table
  • Useful Commands 17:04
    • SHOW TABLES Command & DESCRIBE Utility Statement
    • Example: Creating an Items Table
  • Required Homework 20:51
    • Required Homework: 1 - 6
  • Required Homework (cont.) 21:55
    • Required Homework: 7 - 9

Transcription: Creating Databases & Tables

Hello again, and welcome back to Educator.com's Advanced PHP with MySQL course.0000

In today's lesson, we are going to be learning how to create databases and tables.0005

We are going to learn about specifically creating a database, using what is called the CREATE DATABASE command.0011

And as we learned in a previous lesson, the MySQL server, the way it is set up, contains a number of different databases,0017

each of which can contain a number of different tables.0023

We are going to learn how to create a database for our store web application.0025

We are going to learn about the CREATE TABLE command, which, as the name implies,0030

allows you to create a table within a particular database on the MySQL server.0032

We are going to learn in a little more detail about SQL data types, which are data types for the columns in a table that we will be creating.0038

As we learned before, in relational databases, data is organized in rows and columns.0046

And for each particular column, you can have data values, and they must correspond to a particular data type.0051

We are going to talk about something called column attributes, which in addition to providing a data type0057

for a particular column in a table that we are creating...we can also specify some particular features of that column.0062

We are going to learn how to create the command used to create the Items table in our database,0069

which we are going to be using for our web store application, to hold all of the information about the items in our store.0074

We are going to go over a couple useful commands that can help you to find out0079

about the structure of your database and the structure of tables that you have created.0083

And then, we are going to go over another required homework that you are going to need to do to set up this Items table,0087

so that we can connect to it from our web application.0097

A database is created in SQL using the CREATE DATABASE SQL command.0103

It simply is CREATE DATABASE, followed by the name of the database that you want to create, as a parameter; it is a very simple command.0110

And then, MySQL also provides a couple of non-SQL commands that allow you to provide some information about the MySQL server.0119

When you log into the MySQL server, you can type, for example, SHOW DATABASES.0128

And that is going to list all of the databases that currently exist on that MySQL server that your user has access to.0132

And that is a sort of a privilege thing.0138

Now, we are going to be connecting, in this lesson and all of the other lessons, as the phpuser, which is the account we created in the last lesson.0140

And because they have all privileges, we are going to be able to see all of the databases within the particular MySQL server we are connecting to.0153

There is also the USE command that you can issue that you type in at the MySQL Command Prompt that says,0161

"Use" and you specify the name of a particular database that you want to use.0169

What that does is tells the MySQL Monitor that any future commands you issue are going to be issued on that particular database.0172

For example, if you are inserting data into a database, you won't have to specify (as we will learn,0179

when we learn about inserted statements) both the name of the database and the table you want to insert data to.0186

You will just be able to specify the name of the table, because USE is already going to let MySQL know you are using a particular database.0192

What we are going to do is create our database that we are going to use for our web application, or web store.0199

We are going to call the database advanced_php.0205

And so, what I am going to do is bring up the MySQL Monitor program, which we learned about.0214

And the way you do that, again, is by opening the Windows Command Prompt, and then using this CD command0219

to change to the directory where that mysql.exe file is located (which is the MySQL Monitor client program).0227

And then, we are going to connect as this phpuser account we have created.0246

We type mysql; we don't need to specify the hostname, because we are going to default to the localhost;0251

we are going to be connecting to the MySQL server on the localhost.0256

We are going to be logging in as user phpuser, and we are going to ask it to prompt us for a password.0260

I'm going to go ahead and enter the password that we had set up last time; for this example, we had set up Educator as the password.0269

So now, we can see that we have our MySQL prompt; it shows that we have been able to successfully log in.0276

The first thing we do is run that SHOW DATABASES command that I told you about.0281

And what that is going to do is list all of the different databases that are available on this current MySQL server.0286

We can see that there a number of different databases.0293

Even though we haven't actually created anything, the MySQL database itself comes with its own databases already built--0295

for example, the mysql database; and then, XAMPP does some other things to set up some other databases0307

(for example, some example databases; there is a test database, and so forth).0315

Those are the databases that are currently on this server.0319

Now, we are going to create our advanced_php database: we type CREATE DATABASE0322

and the name that we want to give to it (which is advanced_php), followed by a semicolon, and hit Enter.0328

It is going to say 'query OK' to let us know that the command was successfully run.0335

And then, one thing you can do is use the up and down arrow keys when you are on the MySQL prompt.0340

And it is going to let you scroll through previously entered commands, which can save you some typing.0347

So, because we typed SHOW DATABASES as our last command, if I hit the up arrow once,0350

it is going to go ahead and populate the command prompt with SHOW DATABASES.0354

So now, when I enter it (oops, it looks like I entered a typo; I typed a 3 by accident), SHOW DATABASES,0357

we can see all of the databases that we had before; but now, we also can see our advanced_php database.0370

So now, any of the future commands we are going to be using, we want to operate on this advanced_php database.0377

So, we are going to type USE advanced_php, and that is going to tell this Monitor client that we are going to be using this database,0384

because in a second, we are going to be creating a table in this particular database.0393

It is going to let you know that the database has changed; you are currently using advanced_php.0397

SQL has a command called the CREATE TABLE command, which is what allows you to create database tables.0405

What it does is takes a comma-delimited list of column definitions.0411

You define the columns that you want in your particular table.0417

The command is CREATE TABLE--those are the keywords.0420

And then, you follow it by the name that you want to give the table--for example, you might call it Users.0424

Or for what we are going to be doing in this lesson, we are going to be creating a table called Items to store items' information.0429

And then, you have this comma-delimited list of however many columns you want to create.0435

And what you do is list the name of the column you want to create;0440

you provide the data type of the column; and then you can provide some additional attributes that we are going to talk about0443

to just further define how that column is going to work in the database.0450

And you separate all of the different column definitions by commas.0454

Data types--we talked about that a little in our introduction to databases lesson:0461

SQL provides some data types for data that you store in relational database tables.0463

We are going to specifically talk about some of the specific data types now.0469

There are a couple of numeric data types that we are going to be using.0474

First of all, INT is a data type that represents an integer, just like the int data type in PHP.0478

And what you can do is specify INT, which will allow you to do positive and negative integers.0487

You can also specify as a data type INT UNSIGNED, and that is saying you want an unsigned integer,0491

which means an integer that only holds positive values.0498

We are going to be using that for our item ID's and all of our ID columns in all of our tables.0501

You can also specify a floating-point number using this decimal data type.0507

And what you do is specify the keyword DECIMAL, followed by parentheses, and then followed by two digits.0513

And one we are going to call m, comma, and then the other one, d.0518

What m does is specifies the maximum number of digits that this floating-point number can represent.0523

And then, d is going to represent the number of digits after the decimal point.0528

For example, if we create a column--let's say we create a column (which is what we are going to be doing) called price;0532

and so, we have the name of the column and then data type, and then we specify that we want it to be0541

a maximum of three digits, with two after the decimal place,0548

which means it can only hold numbers of the form x.yz, where it has three total digits, two of which come after the decimal point.0551

We are going to be using that to hold the price of our items in our store.0560

Then, there are a couple of string data types that we are going to be using.0564

The first one is called a CHAR, and it is followed by parentheses with an M parameter.0567

And M is a number that allows you to specify...a CHAR data type says you are creating a fixed-length string;0574

so if you give this data type to a particular column, and you say CHAR(3), what you are saying0585

is that this column that you are using this data type for is going to be a string that is of a fixed length, and it is going to be 3 characters long.0594

An alternative to that is VARCHAR, and what that is: it is a variable-length string that can be up to M characters in length (that you specify).0604

So, you can say VARCHAR(10), which means that this column in this particular table that has this data type0614

can hold a string of variable length, up to 10 characters.0623

There is also the TEXT data type, which is a data type that allows you to store large amounts of string data.0628

And we are going to be using this, for example, for our product description.0637

You might have a product description, maybe, that is a couple of paragraphs long.0639

Well, instead of specifying a VARCHAR to say that this is going to be a variable-length string up to so many digits,0643

you can use something like TEXT, which has a predefined limit to it, but it is very large.0652

And that is, again, for storing large amounts of string data.0656

As mentioned in our CREATE TABLE SQL command, we specify the name of the column, the data type0662

(we just went over the data type), and--there are also some additional attributes you can specify for a particular column.0669

For example, you can specify the attribute called PRIMARY KEY.0675

What that does is: when you specify that in a column's definition, it denotes that that column is the primary key of the table.0679

And when you do this, one thing to note is that if you are defining multiple columns in your table, only one column can have this PRIMARY KEY attribute specified.0685

Another attribute that you can use, which we are going to be using, is called AUTO_INCREMENT.0695

And what that does is: it can be used to apply to integer and floating-point columns--numeric-type columns.0700

And what it does is: when you specify that column as AUTO_INCREMENT, what PHP will do is:0709

when you insert a new row into a table, for whatever column you have specified AUTO_INCREMENT,0716

it is going to look at the largest-value integer or numeric value that is in the table for that particular column,0722

and it is just going to increment it by 1; and it is going to generate that0728

as the new number for that particular column, for that particular row.0730

For example, let's say we have an item in the store, 1001; these are in a kind of tabular format.0738

It is called item1; maybe it is 15 dollars; well, with AUTO_INCREMENT, when you add a new item to the table,0748

it is going to go ahead and look at the largest item...0756

assuming this was the AUTO_INCREMENT column, so it has this AUTO_INCREMENT specifier specified in the CREATE TABLE command,0759

so this is an AUTO_INCREMENT column, when we add a new item to this table,0767

it is going to look and see, "OK, 1001 was the last item added to the table."0770

When we insert this new item, maybe we will specify that it is called item2 that costs 25 dollars;0775

we are just going to increment this by 1, and now it is going to be given the item ID 1002.0781

Now, what we are going to be doing is going over the command that we are going to use to create our table.0790

We are going to put this CREATE TABLE command into action, and we are going to use it to create a table called Items in our database,0793

which we are going to use to hold the items in our particular store.0801

It is going to contain 5 columns in the table.0805

So you can see here, we have 5 column definitions in this CREATE TABLE statement.0808

And I forgot to mention that actually, after you write CREATE TABLE and the command, and then the name of the table,0813

you have a set of parentheses in which you enclose all of the different column definitions.0819

We have five different columns we are creating.0824

The first one we are going to call itemID, which is going to represent the item ID of our column.0827

We are going to have it be an unsigned integer; that is going to be the data type.0831

We are going to have it be auto-incremented; so that means, every time we add an item to our database, it is going to automatically increment that ID.0836

So, it is going to generate it automatically for us.0843

And then, we are going to note that that is going to be the primary key column of the table.0847

Because item ID's are going to be something that is unique (we can't have two items in our store with the same item ID,0851

because then you wouldn't have a way of identifying them), we are going to use this column as our primary key.0858

Again, a primary key column is a column in which you can only have one row in the table that has a particular value.0862

You can't have multiple rows with the same value.0869

In this case, we are not going to be able to have multiple rows in the table with the same item ID.0872

The next column we are going to create is going to be called name.0878

We are going to give it the data type VARCHAR, so it is going to be a variable-length string;0880

and we are going to allow it to be up to 25 characters in length.0884

We are going to create a price column, and we are going to let it be a floating-point number that can be 7 digits long;0888

and it is going to have two digits after the decimal place.0895

So, we can have a number that looks like this, with 5 digits before the decimal point and two digits after.0898

We are going to use that to hold our price.0906

We are going to have a description column, and we are going to set its data type equal to TEXT.0908

And that is going to allow us to store large amounts of text information about the description for our item.0913

And then, we are going to create an image file extension column.0920

And we are going to use the fixed-length string data type, called CHAR, and we are going to say, "Make it a fixed-length string of length 3."0924

So, that means that we can only enter image file extensions that have length 3,0932

which makes sense, because we will be entering things like jpg, gif, and png, for example,0937

which are file extensions that are three characters in length.0944

One thing to note is that, when you create this table using the CREATE TABLE command,0950

the order in which you list these column definitions within the CREATE TABLE command0956

is the order in which they are going to be created in the table.0965

For example, the structure of our table is going to look like this: we will have a table called Items,0967

and it is going to have a number of different columns.0976

And essentially, they are going to have an automatic order to them, and the order is going to be this--the way we specified them.0979

And this is going to become important when we start inserting data into our database,0992

because there is a shortcut that you can do for inserting data, where you can just specify the values1000

for all of the different columns, without saying, "I want this to be the item ID and this to be the name."1006

And so, the order that you put them in is going to be dependent on this order in which the columns are defined within the table.1010

Before we go ahead and create that Items table, what we are going to do is:1025

I am going to tell you about two other useful commands.1030

One is called SHOW TABLES, which--after you have selected a database, using the USE command in the MySQL Monitor,1032

you can type SHOW TABLES, and what that is going to do is allow you to list all of the tables that currently exist in that particular database.1039

If we go back to our MySQL Monitor, we are using the advanced_php database that we have just created, so it shouldn't have any tables in it.1047

So, when we type SHOW TABLES, it is going to say 'empty set,' meaning that there are no tables.1053

There is also a DESCRIBE statement that we are going to go over after we create our Items table1062

that allows you to see the structure of a particular table.1067

You type DESCRIBE, and then the name of the table that you want to see the structure of.1069

And we will be running that on Items.1076

Let's go ahead and create that Items table using the CREATE TABLE statement.1080

We are going to say CREATE TABLE--create a table called Items; we are going to have an open parentheses.1087

Our first column is going to be called item ID; it is going to be an unsigned integer (that is going to be the data type).1097

It is going to have the attributes AUTO_INCREMENT and PRIMARY KEY.1106

One thing I forgot to mention is that, when you specify the attributes, you simply separate them by spaces.1111

We are going to say item ID is an unsigned integer that is going to be auto-incremented, and this is going to be the primary key column of the table.1118

We are going to enter a comma, which is going to say, "We are done with this column definition; let's create the next column,1126

which is going to be name," which we decided was going to be a variable-length string of 25 maximum characters.1131

Again, we enter a comma to start a new column definition.1139

We are going to have price, which is going to be a decimal number that can be 7 digits long, with 2 digits after the decimal place.1143

We are going to have a description column of the text data type, which is going to allow us to store a large amount of string data.1152

And then, we are going to create the image file extension--imageFileExt--column.1159

And we are going to have that be a fixed-length string of length 3.1166

And then, what we do is finish all this by having a closing parentheses, and then a semicolon to go ahead and issue the command.1170

And when we hit Enter, it is going to let us know (assuming it was typed correctly) that the query was OK,1179

which means that the command ran successfully and the table should be created.1185

So now, when we type SHOW TABLES, we should see that this table Items has been created.1188

And sure enough, in the advanced_php database, there is a table called Items.1193

Now, if we want to make sure that the structure of the table that we just created is how we want it to be,1199

we can write DESCRIBE Items, followed by a semicolon.1203

And we can see that it outputs a table that has information about that table Items.1207

We can see that it contains an item ID with an unsigned integer as a data type.1212

It is a primary key, and it has this extra attribute called AUTO_INCREMENT.1217

There is a bunch of other information here that we are not going to really get into,1222

but it does provide other information about the table.1225

It has a name column that can be 25 characters in length.1230

It has a price column, a description column, and an image file extension column.1235

And the thing to note is that the order: this table has 5 columns, and they are in the order itemID, name, price, description, imageFileExt.1238

We have another required homework for this lesson, and that is because it is going to help you to set up this Items database1254

that we are going to be using for our web application.1259

What I want you to do is log in to the localhost MySQL server as phpuser, and do that as the Windows Command Prompt, using the MySQL Monitor program.1262

I want you to type the SHOW DATABASES command to see a list of all the current databases that are on the server,1271

to see that we don't have this advanced_php database yet.1277

Then, go ahead and run the CREATE DATABASE command that is going to create our advanced_php database.1280

And then, when you re-run SHOW DATABASES, you should run that to confirm that the advanced_php database has been added to this particular MySQL server.1286

You are going to select that new database for use.1296

So, when we create a table, it is going to create a table in that advanced_php database.1298

So, we are going to do the USE command; we are going to say USE advanced_php.1303

Run the SHOW TABLES command to get a little practice with that, just showing you that there are no tables1309

in this brand-new database that we created (which makes sense, because we haven't added any yet).1312

And then, create an Items table using the CREATE TABLE command that we used in the lecture,1317

that specifies the item ID column, the name, the price, the description, and the image file extension.1323

And you can look at the slides that we have gone over to see the syntax to do that,1327

so that you create the table exactly as we are going to be using it in our web application.1331

After you do that, you should get a 'query OK' message from MySQL, letting you know that the command ran all right.1337

And then, you can go ahead and issue SHOW TABLES again, and verify that now you have an Items table in that advanced_php database.1344

And then, run the DESCRIBE command, specifying Items as the table you want to describe;1350

and verify that all that information you entered in our CREATE TABLE command...the table was successfully created with those attributes;1356

it has those particular columns, and those particular data types, and any particular column attributes we specified.1365

And assuming all those commands worked, it should see the same output that we saw in the lecture today.1371

That ends today's lesson; thank you for watching Educator.com, and I look forward to seeing you next time.1377

Educator®

Please sign in to participate in this lecture discussion.

Resetting Your Password?
OR

Start Learning Now

Our free lessons will get you started (Adobe Flash® required).
Get immediate access to our entire library.

Membership Overview

  • Available 24/7. Unlimited Access to Our Entire Library.
  • Search and jump to exactly what you want to learn.
  • *Ask questions and get answers from the community and our teachers!
  • Practice questions with step-by-step solutions.
  • Download lecture slides for taking notes.
  • Track your course viewing progress.
  • Accessible anytime, anywhere with our Android and iOS apps.