PHP for Beginners

Build a Content Management System from Scratch with PHP and MySQL

  • Tim Buchalka's Learn Programming Academy
  • 4.62
  • (2756 reviews)
  • 14 hrs
  • 202 lectures
  • Udemy
PHP for Beginners

What you will 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

Your trainer

Tim Buchalka's Learn Programming Academy

The Learn Programming Academy was created by Tim Buchalka, a software developer with 35 years experience, who is also an instructor on Udemy, with over 990K + students in his courses on Java, Python, Android, C# and the Spring framework.

The Academy’s goal in the next three years, is to teach one million people to learn how to program.

Apart from Tim’s own courses, which are all available here, we are working with the very best teachers, creating courses to teach the essential skills required by developers, at all levels.

One other important philosophy is that our courses are taught by real professionals; software developers with real and substantial experience in the industry, who are also great teachers. All our instructors are experienced, software developers!

202 lessons

Easy to follow lectures and videos covering subject details.

14 hours

This course includes hours of video material. Watch on-demand, anytime, anywhere.

Certificate of Completion

You will earn a Certificate of Completion at the end of this course.

Course curriculum

  • Introduction: How to Get the Most Out of the Course01:32
  • Recommended Software Overview02:39
  • Install XAMPP on Windows04:34
  • Install XAMPP on MAC OS X05:30
  • Install XAMPP on Ubuntu Linux03:49
  • Install Atom on Windows02:24
  • Install Atom on MAC OS X03:24
  • Install Atom on Ubuntu Linux02:24
  • Write Your First PHP Code: Display a Message in Your Web Browser03:58
  • Variables in PHP: What They are, How to Create Them, and How to Name Them04:16
  • Basic Variable Types: Strings and Numbers04:58
  • Basic Variable Types: Boolean and Null03:02
  • Perform Operations on Variables: Operators05:36
  • Strings: Using Single or Double Quotes and Variable Interpolation03:36
  • PHP concepts, variables and operators9 questions
  • Variables and Operators1 question
  • Introduction to Arrays: Create an Array and Access its Elements05:04
  • Assign Manual Array Indexes and Create Associative Arrays03:39
  • Create and Access Multidimensional Arrays06:46
  • Process Each Element of an Array: foreach Loops03:24
  • Process the value and index of each array element using a foreach loop02:31
  • Arrays7 questions
  • Arrays1 question
  • Run Code Conditionally: the if Construct05:30
  • Compare One Value to another: Comparison Operators04:29
  • Run Code Multiple Times Based on a Condition: While Loops03:02
  • Run Code a Specific Number Of Times: For Loops04:12
  • Add More Conditions to an If Statement Using Elseif02:43
  • Perform Different Actions Based on Different Conditions: The Switch Statement03:12
  • Control structures and comparison operators8 questions
  • Control structures and comparison operators1 question
  • The Language of Web Pages: an Introduction To Html05:50
  • Use Head and Body Elements to Structure An Html Document05:36
  • Structure the Content of your Page Using Heading and Paragraph Elements02:54
  • Give Text Emphasis or Importance Using the em and Strong Elements03:19
  • Display Ordered and Unordered Lists of Items03:55
  • Insert Images Into an Html Document05:32
  • Add a Link from One Page to Another Using a Hyperlink04:17
  • Add Semantic Structure to The Body of an Html Document05:04
  • HTML9 questions
  • HTML basics1 question
  • Create Dynamic Content: Mixing HTML and PHP07:05
  • Use PHP Control Structures Mixed with HTML04:32
  • Make HTML More Readable: Use Whitespace and Comments04:49
  • Addendum: changes to the available resources in the following video00:16
  • Make PHP Easier To Maintain: Use Comments and Coding Standards05:40
  • Mixing PHP and HTML7 questions
  • Mixing PHP and HTML1 question
  • Where to Store Data in a Dynamic Website: An Introduction to Databases03:33
  • Access the Database Server Using phpMyAdmin And Create a Database07:52
  • Use Tables to Store Structured Data in a Database08:55
  • Select Some Data from The Database: An Introduction to Sql06:00
  • Using Indexes: Make Queries Faster and Order the Result Set06:08
  • Connect to the Database from PHP04:55
  • Query the Database from PHP And Get the Results05:20
  • Combine PHP and HTML to Show a Formatted List of Articles04:18
  • Databases7 questions
  • Databases - connecting and selecting data1 question
  • Add a New Page to Show a Single Article03:23
  • Passing Data in the URL: Send the Article ID Using the Query String05:35
  • Avoid SQL Injection: Validate the ID Passed in from the Query String05:03
  • Don't Repeat Yourself: Extract Repeated Code to a Separate File07:29
  • Addendum: changes to the code in the following video00:19
  • Organise and Secure Access to the Included Files04:30
  • Multiple pages in PHP6 questions
  • Multiple pages in PHP1 question
  • Getting Data From the User: An Introduction to Forms in HTML05:22
  • Change the Method the Form Uses to Send its Data: get vs post05:20
  • Addendum: datetime and datetime-local input types00:14
  • Get Different Types of Data from the User: Basic Input Types05:07
  • Access Data from the form on the Server05:16
  • Add a Multi-line Text Control: the textarea Element02:28
  • Present a Fixed List of Options: the Select Element03:57
  • Toggle an Option on or off: checkboxes04:02
  • Select only one Option from a List: Radio Buttons02:58
  • Add an Accessible Caption to Each Input: the Label Element05:35
  • Make the Form Easier to Use: fieldsets and placeholders02:48
  • Common form Control Attributes: readonly, disabled and autofocus02:41
  • Validate Input Using HTML5 form Validation06:23
  • Forms in HTML11 questions
  • HTML Forms1 question
  • Addendum: the datetime-local input type00:13
  • Add a Form to Insert a New Article03:11
  • Insert Data Into the Database: The SQL INSERT INTO Statement04:37
  • Insert a New Article Into the Database and Get the ID of the New Record04:13
  • How SQL Injection Attacks Work06:12
  • Avoid SQL Injection Attacks: Escape Input02:08
  • Avoid SQL Injection Attacks: Use Prepared Statements04:08
  • Inserting data into the database5 questions
  • Databases - inserting data1 question
  • Functions: Define and Call a Function in PHP07:02
  • Create a Function to Connect to the Database03:56
  • Validate the Form Data and redisplay the Form with Error Messages if Invalid04:19
  • Maintain Previously-supplied Data When redisplaying an Invalid Form04:40
  • Avoid Cross-site Scripting (XSS) Attacks: Escape Untrusted Content05:02
  • Insert NULL if the Publication Date is Empty01:38
  • Validate the Publication Date is a Valid Date and Time05:22
  • Redirect to the Article Page After Inserting a New Article05:18
  • Functions5 questions
  • Functions in PHP1 question
  • Editing Existing Articles: Create a Function to Get a Single Article06:05
  • Add a Form for Editing an Existing Article04:21
  • Add a Validation Function and Validate the Form Data05:38
  • Change Existing Data in the Database: The SQL UPDATE Statement02:38
  • Update an Existing Article in the Database04:04
  • Create a Function to Redirect to Another URL02:54
  • Databases - updating data using MySQLi1 question
  • Delete Existing Data in the Database: The SQL DELETE Statement01:45
  • Delete an Existing Article in the Database03:18
  • Use the POST Request Method to Delete the Article02:20
  • Get Confirmation from the User Before Deleting the Article02:41
  • Improve Database Performance: Only use SELECT * when Necessary04:15
  • Updating and deleting data in the database4 questions
  • Make the Web Browser Remember you Between Visits: An Introduction to Sessions05:28
  • Store Data in the Browser: Cookies in PHP06:03
  • Store a Value in the Session to Log in and Log out a User04:58
  • Add a Login form and Process the User's Login Credentials04:18
  • Completely Destroy the Session on Logout and Redirect Back to the Index Page03:20
  • Increase Security: Prevent Session Fixation Attacks01:56
  • Restrict Access to a Page to a Logged-in User Only04:01
  • Sessions and cookies6 questions
  • Classes and Objects: An Introduction to Object-Oriented PHP04:23
  • Object Attributes: Adding Properties to a Class03:45
  • Object Functions: Adding Methods to a Class03:26
  • Object Initialisation: the Constructor Method02:33
  • Control Access: Public and Private visibility of Properties and Methods02:43
  • Public Properties vs Getter and Setter Methods03:48
  • Static Properties and Methods03:46
  • Constants: Using Define and const to Create Constant Values03:47
  • Inheritance: Using the Extends Keyword to reuse Code and reduce Repetition04:03
  • Overriding Methods and Using the Parent Keyword to Call the Parent Class Code02:52
  • Control Access: Protected Visibility of Properties and Methods04:02
  • Object-oriented PHP10 questions
  • Object-Oriented PHP1 question
  • Add a Database Class and Connect to the Database Using PHP Data Objects (PDO)05:32
  • Queries in PDO: Change the Index Page to Use the New Database Class02:13
  • Catch Database Errors Using Exceptions and try ... catch Blocks05:15
  • Prepared Statements with Named Parameters in PDO: view an Individual Article05:50
  • Create an Article Class and Use it on the Index and Article Pages03:38
  • Fetch the Database Record as an Object Instead of an Array02:43
  • Update the Article Record Using PDO05:38
  • Move the Validation Function to the Article Class04:47
  • Delete the Article Record Using PDO03:02
  • Insert a new Article Record Using PDO and get the ID of the New Record06:16
  • Create a User Class and a Method to Authenticate a User02:37
  • Create a Table to Store User Data in the Database02:21
  • Authenticate the User with Data from the Database04:40
  • Store Passwords Securely: PHP Password Hashing Functions06:23
  • Store the Password as a Hash in the Database and Verify it on Login02:08
  • PDO and password hashing6 questions
  • Convert the auth Include into a Class03:12
  • Convert the url Include into a Class02:45
  • Autoloading Classes: Require Class Files Automatically03:47
  • Add an Initialisation Script Including an Autoloader04:04
  • Returning a Value Using Require: Add a Script to get the Database Connection03:47
  • Move all Authentication-related Code to the Auth Class03:53
  • Create an Admin Index and Load Classes Relative to the site root Directory06:45
  • Displaying Tabular Data in HTML: Tables06:49
  • Display the Admin List of Articles in a Table and Restrict Access to the Page02:58
  • Add Sitewide Navigation Links05:04
  • Move the Edit and Delete Article Scripts to the admin Area04:40
  • Move the New Article Script to the admin Area03:09
  • Autoloading classes and requiring files4 questions
  • Pagination: Split Database Results up Into Pages03:06
  • Add a Method to the Article Class to get a Single Page of Article Records02:42
  • Add a Paginator Class and Calculate the offset and Limit from the Page Number03:37
  • Get the Page Number from the Query String03:34
  • Validate the Page Number using the filter_var Function03:54
  • Add Previous and Next Pagination Links03:35
  • Calculate the Total Number of Records and Pages04:12
  • Add Pagination to the admin Index and Create Shared Pagination Links05:00
  • Tables and pagination5 questions
  • Uploading Files: Add a Form to Upload an Article Image04:58
  • Handle the Upload Error Code03:04
  • Restrict the Size of all Uploaded Files using PHP Configuration Settings06:24
  • Restrict the Size of an Uploaded File in an Individual Form01:40
  • Restrict the Type of an Uploaded File04:05
  • Create a Folder for Uploads and Move the Uploaded File into it04:19
  • Sanitise the Uploaded Filename as a Security Precaution03:01
  • Don't Overwrite Existing Files in the Uploads Folder03:04
  • Save the Filename to the Article Record in the Database03:29
  • Display the Uploaded Image if an Article has one01:59
  • Delete the Previous image File when an Article Image is Updated02:21
  • Add an Option to Delete an Article's Image file04:15
  • Uploading files7 questions
  • Database Relationships: Create a Table and Data for Categories02:25
  • One-to-one Relationships Between Tables03:47
  • One-to-many Relationships Between Tables02:00
  • Joins: Selecting Data from Multiple, Related Tables at Once04:06
  • Relationship Constraints03:59
  • Many-to-many Relationships Between Tables05:46
  • Show an Article's Categories on the Individual Article Page06:10
  • Get an Article's Categories in an Object Method03:13
  • Add a Category Class and form Inputs to edit an Article's Categories05:36
  • Insert Article Categories while Avoiding Duplicate Records in the Join Table07:39
  • Insert Article Categories more Efficiently using a Single Query04:18
  • Delete Article Category Records if Unchecked in the Form04:19
  • Add Categories When Inserting a new Article Record04:26
  • Pagination and Joins: Show Categories in the Index Page09:26
  • Database relationships5 questions
  • Execute Code in the Browser: An Introduction to JavaScript06:10
  • Using the jQuery Library05:22
  • Add jQuery and a Custom Script file to the CMS02:57
  • Add Delete Confirmation Using JavaScript and POST07:23
  • Client-side form Validation Using the jQuery Validation Plugin05:38
  • An Introduction to Ajax with PHP06:13
  • Use JSON to Safely Encode Structured Data in an Ajax Request05:30
  • JavaScript and PHP8 questions
  • Only Show an Individual Article if it's been Published03:18
  • Only Show Published Articles on the Index Page03:40
  • Use the DateTime Class and the Time Element to Show the Published Date and Time04:05
  • Show the Published Date and Time of Articles in the admin Area02:19
  • Publish Unpublished Articles Using an Ajax Request07:46
  • Add Styling and Formatting to HTML: an Introduction to CSS05:54
  • Using CSS Frameworks: Bootstrap et al02:59
  • Add a General Layout and Style the Navigation Links03:10
  • Add Styling and Layout to Forms and Tables02:40
  • Add a Custom Stylesheet and Style the List of Articles03:22
  • Add a Date and Time Picker Plugin to make Selecting Dates and Times Easier03:56
  • CSS basics4 questions
  • Add a Contact Page for Sending an Email02:48
  • Validate the Submitted Contact Form04:27
  • Get Access to a Mail Server02:50
  • How to Send Email from PHP: the Mail Function and PHPMailer05:34
  • Send Email from the Contact Page Using PHPMailer03:27
  • Extract Environment-dependent Settings out into a Single Configuration File05:03
  • Deny Direct Access to the config file from a Browser02:31
  • Handing Errors and Exceptions: user-defined Handling Functions05:35
  • Display Error and Exception Details Depending on the Environment04:53
  • HTTP Status Codes and Handling Ajax Errors04:24
  • Sending emails and error handling3 questions
  • Deployment: Publish your Code on a Live Server06:00
  • Conclusion: Where to go from Here01:38
  • Source Code for all Lectures10:38
  • Bonus Lecture and Information04:49
Online Courses

Learning PHP doesn't have to be hard. Here is our curated list of recommended online courses that will guide you step-by-step in the learning process.

Learn more
Books

Are you an avid book reader? Do you prefer paperback, or maybe Kindle version? Take a look at our curated list of PHP related books and take yourskills to the next level.

Learn more
YouTube videos

The number of high-quality and free PHP video tutorials is growing fast. Check this curated list of recommended videos - there is no excuse to stop learning.

Learn more