SQL with PDO
Jump to navigation
Jump to search
Contents
PHP, PDO and MySQL at the Movies
This tutorial takes you through building a web site to show details of Movies held in a database.
You will need to have access to a machine with the LAMP stack - Napier students can use inf08104 or socweb8.napier.ac.uk
Exploring the world database with scott
- Connect to the database scott on inf08104
- Run and SQL SELECT statement using PDO
- Output each row in a while loop
Connect to your own database
- Find out your password
- Download a database htpp://sqlzoo.net/world.sql
- Import your database into MySQL
- Change something about the world
- Update your php to look at your own copy of the world database
Look at one movie from the movie database
- Download the movie database from http://sqlzoo.net/moviesm.sql
- Find the id of "Toy Story"
- Write a PHP query to look up that movie and show details
Use a parameter in your movie query
- Change toystory.php so it takes a CGI variable
- Visit the page with the CGI variable set
- Make up an index page with links to the best movies ever