PHP with PDO and OOP for beginners

Learn PHP with PDO, Object Oriented PHP programming, MySQL and Bootstrap to create powerful and secure websites and apps
4.6 (9 ratings) Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
204 students enrolled
$19
$20
5% off
Take This Course
  • Lectures 74
  • Length 6 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 4/2016 English

Course Description

PHP is one of the most popular programming languages. In this series, we will learn PHP programming basics, using a local server. Then we will use a PHP layer known as PHP data object PDO, to create secure and portable web applications. As a bonus, we will learn SQL and Bootstrap basics, to design databases, and create responsive platforms. At the end, we will create Object Oriented Programming functions and classes, and this section will help students to start their next step, which is learning a PHP framework. This course is meant for total beginners in any programming language. At the end of this course, you will be able to create databases, bootstrap designs, secure and responsive web applications with a strong login system.

What are the requirements?

  • Just a text editor

What am I going to get from this course?

  • Create Databases
  • Learn MySQL with PHP
  • Learn Basics of PHP Programming
  • Learn PDO with PHP to create secure web applications
  • Learn Object Oriented PHP Programming
  • Create advanced, well designed, responsive PHP and PDO based web applications
  • Learn Bootstrap
  • Create a powerful and secure login system
  • Learn Object Oriented Programming with PHP
  • Sessions and Cookies in PHP
  • And much much more

What is the target audience?

  • This course is meant for newbies in PHP
  • This course is for developers who wants to learn PDO
  • This course is for PHP programmer who want to learn Object Oriented Programming
  • This course is for absolute beginners in programming

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Installations and Workspace
05:15

PHP is one of the best programming languages used in web development and by almost thousands of websites like Facebook and Quora. It is a server-side language that recommends a server to execute PHP scripts. I recommend starting learning PHP language before PHP frameworks. The language itself will help us to figure out how to resolve errors and how to build and design our project.

03:27

In this course, we will need to work with a server like wamp for windows and mamp for Mac OS. And for databases, I recommend to download and install MySQL server with MySQL workbench. We are going to work locally using wamp.

02:27

We will encounter some errors while we are installing our local server, and we should close all softwares that run and test the port 80. This lecture will help to eliminate those startup errors that all PHP newbie will stuck in them for hours.

02:59

In this lecture, we are going to see the difference between server-side languages like PHP, Python, Ruby, and Java and client-side languages like JavaScript, HTML, and CSS.

02:01

In this lecture, we will learn how a communication occurs between a computer and database, using a layer used by PHP and called Database Abstraction Layer.

02:42

PDO is a lightweight interface, to access databases using PHP, and each database driver like MySQL, SQLite and Oracle should implement PDO interface. In this lecture we will learn about why PDO is more secure than other interfaces.

03:35

PHP is a server-side language. And to run .php extension files, and PHP scripts, those files should be installed in the local root of the server.

04:44

SQL injection is a way used by hackers to access and break web application using URL or the login form of a website. It is used by developer to test if their project is vulnerable and weak, and needs some improvements.

Section 2: PHP Basics
02:03

In this lecture, we will learn how to start typing PHP and what parts of a web page, the PHP interpreter execute using the PHP tags <?php ?> to identify it.

02:39

In this lecture, we learn how to print and echo results, and we will see the difference between them. We have a third function to print results: print_r() and we will use it later.

08:41

In this lecture, we will learn how PHP is different than other static languages and what types we can use in our PHP scripts. Usually we can define strings, integers, arrays, floats, doubles, and more.

02:20

In this lecture, we will learn how to make conditions into specific results and what is the value returned inside each condition.

02:32

In this lecture, we will see the difference between equality == and strict equality ===. Usually, equality will compare 2 variable values without caring about their types, and strict equality will compare variable types and values.

03:12

In this lecture, we will learn how to increment number using ++ and decrement them using - -.

03:28

There is a big difference between elseif and else if, when we are typing PHP scripts. We will take a simple example to understand it.

03:01

In this lecture, we will learn about while and do-while loops. The result will be the same, but syntax and slightly different.

03:32

In this lecture, we will learn about the other loop method in PHP, For and foreach. Usually we use foreach when we are iterating over an associative array.

02:35

Infinite loops are dangerous and may make harms to computers and our applications. We should be aware from making a false conditioning inside loops. Usually, infinite loops are used to make some test on a server, and they are scheduled.

05:07

From their names, break will help us to break a loop when a certain condition is true, while continue, will take us into next step of the loop when a specific condition is achieved.

06:07

Switch will help us to take specific values of a variables and set conditions and actions for each one of them. In this lecture, we take a simple example and see why and where we should use switch.

02:07

Goto will help us to skip some script lines, to execute another portion of the code, when a certain condition is true.

03:55

Basically, require_once() and include_once() will help us to add an external file into our page. But require_once() will stop executing any further PHP lines, if the file contain errors and display them. And include_once() will continue executing PHP lines but it will show us the error.

04:17

In this lecture, we will learn the and && and the or || operators, which help us to add more conditions inside a loop or an IF statement.

04:48

In this lecture, we will learn how to declare an indexed array, how to get array size, and how to use a loop to display all values.

03:43

Associative arrays are important when we work with AJAX and JSON. In this lecture, we will learn how to declare them, and display them on screen using foreach() loop.

06:47

In this lecture, we will learn how to declare and print multi-dimensional arrays.

04:14

They are multiple arrays premade functions to use while working with arrays. In this lecture we will learn how to merge, shift, and push arrays into other variables.

04:40

As other languages, we can work with math using PHP premade functions. In this lecture, we will learn some of them.

05:02

In this exercise we will calculate a factorial of a number and use a new function to test if a result is infinite or not.

08:05

In this exercise, we will create random arrays and fill them with random numbers, and create some discounts on the total sum.

03:35

In this exercise, we will take a premade script, and make iterations according to loops, and display the final results.

10 questions

In this quiz, we will make a recap, about all programming basics that we had seen in the previous sections.

Section 3: PHP and MySQL
04:06

In this lecture, we will learn how to enable error reporting while we are working offline, designing our web app, and how to set error reporting functions, when we put our work online.

07:14

In this lecture, we will see in details, each part of our connection strings, and what every single variable means.

11:39

In this lecture, we will learn how to design databases using MySQL workbench and PHPMyAdmin.

13:02

In this lecture, we will learn how to start working with bootstrap classes, to create responsive web applications and websites.

02:43

Servers only work with HTML name tags. So we should add name tags to each text box, and other HTML elements we have.

02:14

In this lecture, we will set up, the working space of our first landing page, which is the login page.

02:26

In this lecture, we will learn how to get data from HTML forms, into PHP server, using POST and Get methods. Then, we will walk through the difference between them.

02:38

In this lecture, we will learn how to use isset() and !isset() functions to see if a button is clicked, or a variable is set to a value.

06:11

MD5 isn’t a secure encryption method nowadays, to use it with passwords. We will use it for now, and in section 4, we will learn how to encrypt passwords using advanced crypto techniques.

05:02

In this lecture, we will type our first SQL query and use query() function to run it and get the results. This SQL query is without any parameters and when we use queries with variables, we should use another type of queries like prepare ().

02:40

In this lecture, we will see how to add parameters to SQL query, and why the PDO type is better than the old unsecure method where we were adding directly variables into queries and execute them, which get us into big security problems.

02:30

In this lecture, we will add our variables, into SQL query using bindValue() or bindParam(). And in this lecture, we will the difference between those 2 functions, but the both will help us to get the same result at the end.

03:12

In this lecture, we will learn how to execute queries using execute() functions, and fetch the result into a new variable using fetch() or fetchAll() functions. Then, we will learn how to check if a row exists in our database, using 2 methods.

02:47

In this lecture, we will create our first function. We have function that can take parameters, like the example in this lecture.

Section 4: Sessions and Cookies
02:53

In this lecture, we will see the difference between sessions and cookies, and we will start using sessions by checking if their already active one or not.

03:42

In this lecture, we will learn how to save user credentials in session. We will learn how to go to next page using header() function after a successful login.

03:35

In this lecture, we will create a global connection file and add it in all our pages, using require_once() function.

05:31

In this lecture, we will learn how to create a logout page, and destroy all our session using unset() and session_destroy() functions, and redirect into the login page.

02:27

In this lecture, we will learn how to create and set cookies, and specify their end-time using setcookie() and time() function.

04:37

In this lecture, we will improve password field, and add hashed strings instead of using MD5 encryption. Then, we will use password_verify() to see if a typed password would be the same as the hashed value in our database. This method will help us to increase our security level. At the end, we will learn about var_dump() function, that help us to get all information about a variable or a function.

05:58

In this lecture, we will learn about more super global variables like $_REQUEST and $_SERVER. We have $_FILES, $GLOBALS and more.

Section 5: AdminPanel Project
15:16

In this lecture, we will learn SQL query basics, from selecting a specific column, insert new data, updating existing information, delete rows, and create SQL views.

03:27

In this lecture, we will prepare our webpages and add some buttons, before we start programming and selecting data from database into our site.

02:01

In this lecture, we will see multiple types of returned arrays inside our fetch() and fetchAll() functions. And we will use fetchColumn() if we need to return a specific column of a table.

19:21

In this lecture, we will create an HTML table that will get all rows from login table, and we will add text boxes at the end, to add new users.  

06:35

In this lecture, we will create a delete button for each row we have in our table created in exercise 4.

02:40

In this lecture, we will create an update button to update user information.

09:23

In this lecture, we will learn how to get the last inserted ID into any table of our database, using a PHP function called lastInsertId(). We should know where to add this function and after which query, so we can get the correct id.

02:30

In this lecture, we will see 2 main types of errors. The first one is PHP error when we have syntax errors. And the second type is when we are handling with database, so it is called PDO Exception error.

Section 6: Object Oriented Programming in PHP
02:27

In this lecture, we will learn why we should use OOP in PHP, because it’s reusable, readable, and perfectly fit an advanced PHP based web application project. We will learn some new keywords like: object, class, method, property, and handler.

02:17

In this lecture, we will learn how to declare a class. A class is a blueprint of an object.

02:28

In this lecture, we will learn how to declare a new property for a class. And we will see different restrictions that we can use when we work with properties. Those restrictions can be used by the functions.

02:19

In this lecture, we will type our first method, and we will use a built-in variable called $this that refer to the current object, and help us to access a property or function in our class.

07:05

In this lecture, we will learn how to access a function a get a result from it. And we will learn the setter and getter method, where we make changes into a method, and we echo the result inside another method. 

03:21

In this lecture, we will learn how to include a class inside our web pages. Then, we will add a constructor method to our class, to initiate our properties. Construct method is automatically created when a class is executed.

10:31

In this lecture, we will solve exercise 6, where we are going to make changes on our procedural script and transform it into object oriented PHP script.

07:41

In this part, we will continue modifying our script, and run it when we click on the login button.

02:27

Inheritance in OOP is creating a new class that may use methods from another class. To do so, we use the ‘extends’ keyword for this. 

09:55

In this lecture we will solve the exercise 7, where we are going to change the insert procedural script into Object Oriented script.

02:41

In this lecture we will learn how to override an existing method of a parent class in the child class. And how to make restrictions on the methods and classes in the parent file.

05:14

In this lecture, we will learn about interfaces and abstract classes. The difference between them, and why we use them in our projects.

05:22

In this lecture, we will learn how to use a static keyword with a class, method, or a property, and why using static keyword will help us to reduce the amount of resources used, when executing a script.

01:26

A destructor method helps us to destruct the object created, when execution is done. Usually PHP will automatically create a destructor for each class, but there is no harm from typing a destructor method in each class.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Eng Ali Mehdy, Electrical and Telecommunications Engineer

I am an Electrical, Telecommunications and IT engineer graduate with a Master degree since 2013, with experience in designing software and web apps for telecommunication purposes, designing household electrical schematics and designing electrical panels. I have an advanced experience programming industrial microprocessors PLC. And now I am an Udemy Premium Instructor.

Ready to start learning?
Take This Course