In this course you will learn how to create dynamic, data driven websites using the LAMP stack. The course focuses on the integration of the LAMP components (especially MySQL and PHP) to create a complete working site. Throughout the course, a lending library that needs a web application to track its books and borrowers provides a scenario for discussion and demonstration. Attention is also paid to best practices for keeping the site secure. Students should have a basic prior knowledge of relational databases and SQL and of the PHP language (variables, operators, loops, branches, and simple string handling). Basic competence at the Linux command line (including the ability to edit text files) is also assumed. Students can follow along with all demos by pre-installing Centos 6 (or similar) into a virtual machine.
Accessing a Database from PHP Welcome to Pluralsight, and welcome to this course on Building Dynamic Websites with PHP and MySQL. I'm Dr. Chris Brown. This lesson is called Accessing a Database from PHP, and it's really at the heart of the course because this is the first time we've brought together our two core technologies, MySQL and PHP. Now we're going to focus on a set of extensions to PHP called PDO, that's PHP Data Objects. And we'll see how to use these extensions to connect to the database and log in, to build and execute a query to retrieve the results and display them, and we'll use this to implement a book search page for our library. I'll also talk a bit about validating user input and we'll end with a brief comparison of PDO with mysqli, which is a competing library in some sense. So, PDO is a set of PHP extensions for accessing databases. It's Object-Oriented. So, there may be some conceptually new stuff here if you've not done any OO programming before, and it also supports error notification through the use of exceptions. Again, this may be new to you. Now, PDO supports multiple databases, but you have to install the driver that's appropriate to the database you want to use. Obviously, our interest here is in using MySQL, and it's available from PHP 5. 1 onwards.