PHP for Beginners

PHP for Beginners

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 14 Hours | 1.50 GB

Build a Content Management System from Scratch with PHP and MySQL

Are you wanting to get into Web development, but are not sure where to start?

So maybe you tried out some PHP and MySQL tutorials on Youtube, but found them too hard or outdated, and feel that you need a more comprehensive introduction.

Maybe you want to learn how to write PHP the right way. Secure code, OOP ready, and maximising re-usability as well as finding out about PHP programming standards to adopt and adhere too?

Perhaps your boss or client threw you in the deep end with a PHP and MySQL project, and you need to get up to speed with PHP, fast.

Whatever the reason, this course is for you.

This course is going to teach you how to create web applications using PHP and MySQL. Specifically, you will learn PHP and then create you own content management system (CMS) from scratch.

Why PHP?

PHP is the most popular website programming language in the world. The combination of PHP and MySQL is used extensively to create web applications, and developers with these key skills are in high demand. This course is going to teach you how to create web applications in PHP using the MySQL database.

What will you learn in this course?

You will learn how to create a dynamic website using the most popular website programming language in the world, PHP.

Dave Hollingworth, your instructor will teach you the PHP programming language, and take you through the steps to build a working CMS in PHP and MySQL from scratch.

Along the way, you will learn how to secure your code, how to write reusable, more maintainable code using programming standards, and how to structure your code using object-oriented programming techniques.

Dave will teach you the theory and then put the theory into practice when building the CMS.

You will also learn how to style your site using Bootstrap, how to integrate third-party code into your site, how to store data in a relational database and use this from PHP code, and more.

The course is very thorough, and goes through everything from installing a web server on your own computer, and editor to writing the code to create your web app. Towards the end of the course you will even learn how to upload the code and make your code live on the internet (very useful if you already have your own Hosting account). This is not necessary to complete the course though.

In summary, the course will teach you the core skills you need to know to become a productive PHP programmer.

Why this course?

Firstly, Dave has been creating web applications since 1999, when he created his first web application for a major insurance company. In addition he has been teaching IT for many years.

As a result, you will be learning the best practices from an experienced developer.

Dave will teach you the theory but then show how to put those techniques into practice. You will start building a CMS application from early on in the course and new techniques and theory are introduced as and when they’re needed to build the next part of the CMS.

New code is introduced one word or one line at a time, so you will never get bogged down or overwhelmed.

You will also learn real-world developer skills such as referring to and getting the most out of the documentation. This is an essential skill for developers to learn.

After completing this course, you will have the necessary skills to be able to create your own web applications with PHP and MySQL.

What you’ll learn

  • Learn how to create a dynamic website using the most popular website programming language
  • Build a working CMS in PHP and MySQL from scratch
  • Learn how to secure your code
  • Learn how to write reusable, more maintainable code using programming standards
  • Learn how to structure your code using object-oriented programming techniques
  • Learn the theory but then put it into practice in a CMS project
  • Style your site using Bootstrap
  • How to integrate third-party code into your site
  • How to store data in a relational database and use this from PHP code
  • Learn all aspects of a basic web application in PHP: login, CRUD operations, sending emails, uploading files, Ajax
Table of Contents

Introduction
1 Introduction: How to Get the Most Out of the Course

Software Installation and Setup
2 Recommended Software Overview
3 Install XAMPP on Windows
4 Install XAMPP on MAC OS X
5 Install XAMPP on Ubuntu Linux
6 Install Atom on Windows
7 Install Atom on MAC OS X
8 Install Atom on Ubuntu Linux

Variables
9 Write Your First PHP Code: Display a Message in Your Web Browser
10 Variables in PHP: What They are, How to Create Them, and How to Name Them
11 Basic Variable Types: Strings and Numbers
12 Basic Variable Types: Boolean and Null
13 Perform Operations on Variables: Operators
14 Strings: Using Single or Double Quotes and Variable Interpolation

Arrays
15 Introduction to Arrays: Create an Array and Access its Elements
16 Assign Manual Array Indexes and Create Associative Arrays
17 Create and Access Multidimensional Arrays
18 Process Each Element of an Array: foreach Loops
19 Process the value and index of each array element using a foreach loop

Control structures
20 Run Code Conditionally: the if Construct
21 Compare One Value to another: Comparison Operators
22 Run Code Multiple Times Based on a Condition: While Loops
23 Run Code a Specific Number Of Times: For Loops
24 Add More Conditions to an If Statement Using Elseif
25 Perform Different Actions Based on Different Conditions: The Switch Statement

An Introduction to HTML
26 The Language of Web Pages: an Introduction To Html
27 Use Head and Body Elements to Structure An Html Document
28 Structure the Content of your Page Using Heading and Paragraph Elements
29 Give Text Emphasis or Importance Using the em and Strong Elements
30 Display Ordered and Unordered Lists of Items
31 Insert Images Into an Html Document
32 Add a Link from One Page to Another Using a Hyperlink
33 Add Semantic Structure to The Body of an Html Document

Mixing PHP and HTML
34 Create Dynamic Content: Mixing HTML and PHP
35 Use PHP Control Structures Mixed with HTML
36 Make HTML More Readable: Use Whitespace and Comments
37 Addendum: changes to the available resources in the following video
38 Make PHP Easier To Maintain: Use Comments and Coding Standards

An Introduction to Databases
39 Where to Store Data in a Dynamic Website: An Introduction to Databases
40 Access the Database Server Using phpMyAdmin And Create a Database
41 Use Tables to Store Structured Data in a Database
42 Select Some Data from The Database: An Introduction to Sql
43 Using Indexes: Make Queries Faster and Order the Result Set
44 Connect to the Database from PHP
45 Query the Database from PHP And Get the Results
46 Combine PHP and HTML to Show a Formatted List of Articles

Multiple Pages in PHP
47 Add a New Page to Show a Single Article
48 Passing Data in the URL: Send the Article ID Using the Query String
49 Avoid SQL Injection: Validate the ID Passed in from the Query String
50 Don’t Repeat Yourself: Extract Repeated Code to a Separate File
51 Organise and Secure Access to the Included Files

An Introduction to HTML Forms
52 Getting Data From the User: An Introduction to Forms in HTML
53 Change the Method the Form Uses to Send its Data: get vs post
54 Get Different Types of Data from the User: Basic Input Types
55 Access Data from the form on the Server
56 Add a Multi-line Text Control: the textarea Element
57 Present a Fixed List of Options: the Select Element
58 Toggle an Option on or off: checkboxes
59 Select only one Option from a List: Radio Buttons
60 Add an Accessible Caption to Each Input: the Label Element
61 Make the Form Easier to Use: fieldsets and placeholders
62 Common form Control Attributes: readonly, disabled and autofocus
63 Validate Input Using HTML5 form Validation

Inserting Data Into the Database from PHP
64 Add a Form to Insert a New Article
65 Insert Data Into the Database: The SQL INSERT INTO Statement
66 Insert a New Article Into the Database and Get the ID of the New Record
67 How SQL Injection Attacks Work
68 Avoid SQL Injection Attacks: Escape Input
69 Avoid SQL Injection Attacks: Use Prepared Statements

An Introduction to Functions and Validation in PHP
70 Functions: Define and Call a Function in PHP
71 Create a Function to Connect to the Database
72 Validate the Form Data and redisplay the Form with Error Messages if Invalid
73 Maintain Previously-supplied Data When redisplaying an Invalid Form
74 Avoid Cross-site Scripting (XSS) Attacks: Escape Untrusted Content
75 Insert NULL if the Publication Date is Empty
76 Validate the Publication Date is a Valid Date and Time
77 Redirect to the Article Page After Inserting a New Article

Editing Data in the Database from PHP
78 Editing Existing Articles: Create a Function to Get a Single Article
79 Add a Form for Editing an Existing Article
80 Add a Validation Function and Validate the Form Data
81 Change Existing Data in the Database: The SQL UPDATE Statement
82 Update an Existing Article in the Database
83 Create a Function to Redirect to Another URL

Deleting Data from the Database from PHP
84 Delete Existing Data in the Database: The SQL DELETE Statement
85 Delete an Existing Article in the Database
86 Use the POST Request Method to Delete the Article
87 Get Confirmation from the User Before Deleting the Article
88 Improve Database Performance: Only use SELECT * when Necessary

Using Sessions to Log in and Restrict Access
89 Make the Web Browser Remember you Between Visits: An Introduction to Sessions
90 Store Data in the Browser: Cookies in PHP
91 Store a Value in the Session to Log in and Log out a User
92 Add a Login form and Process the User’s Login Credentials
93 Completely Destroy the Session on Logout and Redirect ack to the Index Page
94 Increase Security: Prevent Session Fixation Attacks
95 Restrict Access to a Page to a Logged-in User Only

An Introduction to Object-Oriented PHP
96 Classes and Objects: An Introduction to Object-Oriented PHP
97 Object Attributes: Adding Properties to a Class
98 Object Functions: Adding Methods to a Class
99 Object Initialisation: the Constructor Method
100 Control Access: Public and Private visibility of Properties and Methods
101 Public Properties vs Getter and Setter Methods
102 Static Properties and Methods
103 Constants: Using Define and const to Create Constant Values
104 Inheritance: Using the Extends Keyword to reuse Code and reduce Repetition
105 Overriding Methods and Using the Parent Keyword to Call the Parent Class Code
106 Control Access: Protected Visibility of Properties and Methods

PDO: PHP Data Objects
107 Add a Database Class and Connect to the Database Using PHP Data Objects (PDO)
108 Queries in PDO: Change the Index Page to Use the New Database Class
109 Catch Database Errors Using Exceptions and try … catch Blocks
110 Prepared Statements with Named Parameters in PDO: view an Individual Article
111 Create an Article Class and Use it on the Index and Article Pages
112 Fetch the Database Record as an Object Instead of an Array
113 Update the Article Record Using PDO
114 Move the Validation Function to the Article Class
115 Delete the Article Record Using PDO
116 Insert a new Article Record Using PDO and get the ID of the New Record

Authentication Using the Database
117 Create a User Class and a Method to Authenticate a User
118 Create a Table to Store User Data in the Database
119 Authenticate the User with Data from the Database
120 Store Passwords Securely: PHP Password Hashing Functions
121 Store the Password as a Hash in the Database and Verify it on Login

Class Autoloading
122 Convert the auth Include into a Class
123 Convert the url Include into a Class
124 Autoloading Classes: Require Class Files Automatically
125 Add an Initialisation Script Including an Autoloader
126 Returning a Value Using Require: Add a Script to get the Database Connection

Site Administration
127 Move all Authentication-related Code to the Auth Class
128 Create an Admin Index and Load Classes Relative to the site root Directory
129 Displaying Tabular Data in HTML: Tables
130 Display the Admin List of Articles in a Table and Restrict Access to the Page
131 Add Sitewide Navigation Links
132 Move the Edit and Delete Article Scripts to the admin Area
133 Move the New Article Script to the admin Area

Pagination
134 Pagination: Split Database Results up Into Pages
135 Add a Method to the Article Class to get a Single Page of Article Records
136 Add a Paginator Class and Calculate the offset and Limit from the Page Number
137 Get the Page Number from the Query String
138 Validate the Page Number using the filter_var Function
139 Add Previous and Next Pagination Links
140 Calculate the Total Number of Records and Pages
141 Add Pagination to the admin Index and Create Shared Pagination Links

Uploading Files
142 Uploading Files: Add a Form to Upload an Article Image
143 Handle the Upload Error Code
144 Restrict the Size of all Uploaded Files using PHP Configuration Settings
145 Restrict the Size of an Uploaded File in an Individual Form
146 Restrict the Type of an Uploaded File
147 Create a Folder for Uploads and Move the Uploaded File into it
148 Sanitise the Uploaded Filename as a Security Precaution
149 Don’t Overwrite Existing Files in the Uploads Folder
150 Save the Filename to the Article Record in the Database
151 Display the Uploaded Image if an Article has one
152 Delete the Previous image File when an Article Image is Updated
153 Add an Option to Delete an Article’s Image file

Database Relationships
154 Database Relationships: Create a Table and Data for Categories
155 One-to-one Relationships Between Tables
156 One-to-many Relationships Between Tables
157 Joins: Selecting Data from Multiple, Related Tables at Once
158 Relationship Constraints
159 Many-to-many Relationships Between Tables

Using Relationships: Article Categories
160 Show an Article’s Categories on the Individual Article Page
161 Get an Article’s Categories in an Object Method
162 Add a Category Class and form Inputs to edit an Article’s Categories
163 Insert Article Categories while Avoiding Duplicate Records in the Join Table
164 Insert Article Categories more Efficiently using a Single Query
165 Delete Article Category Records if Unchecked in the Form
166 Add Categories When Inserting a new Article Record
167 Pagination and Joins: Show Categories in the Index Page

JavaScript and PHP
168 Execute Code in the Browser: An Introduction to JavaScript
169 Using the jQuery Library
170 Add jQuery and a Custom Script file to the CMS
171 Add Delete Confirmation Using JavaScript and POST
172 Client-side form Validation Using the jQuery Validation Plugin
173 An Introduction to Ajax with PHP
174 Use JSON to Safely Encode Structured Data in an Ajax Request

Dates and Times
175 Only Show an Individual Article if it’s been Published
176 Only Show Published Articles on the Index Page
177 Use the DateTime Class and the Time Element to Show the Published Date and Time
178 Show the Published Date and Time of Articles in the admin Area
179 Publish Unpublished Articles Using an Ajax Request

An Introduction to CSS
180 Add Styling and Formatting to HTML: an Introduction to CSS
181 Using CSS Frameworks: Bootstrap et al
182 Add a General Layout and Style the Navigation Links
183 Add Styling and Layout to Forms and Tables
184 Add a Custom Stylesheet and Style the List of Articles
185 Add a Date and Time Picker Plugin to make Selecting Dates and Times Easier

Sending Emails from PHP
186 Add a Contact Page for Sending an Email
187 Validate the Submitted Contact Form
188 Get Access to a Mail Server
189 How to Send Email from PHP: the Mail Function and PHPMailer
190 Send Email from the Contact Page Using PHPMailer

Configuration and Error Handling
191 Extract Environment-dependent Settings out into a Single Configuration File
192 Deny Direct Access to the config file from a Browser
193 Handing Errors and Exceptions: user-defined Handling Functions
194 Display Error and Exception Details Depending on the Environment
195 HTTP Status Codes and Handling Ajax Errors

Conclusion
196 Deployment: Publish your Code on a Live Server
197 Conclusion: Where to go from Here

Bonus Material
198 Bonus – Please Watch!
199 Check out Our Other 41 Udemy Courses!
200 Source Code for all Lectures