Practical PHP and MySQL Website Databases: A Simplified Approach

Book description

Practical PHP and MySQL Website Databases is a project-oriented book that demystifies building interactive, database-driven websites. The focus is on getting you up and running as quickly as possible. In the first two chapters you will set up your development and testing environment, and then build your first PHP and MySQL database-driven website. You will then increase its sophistication, security, and functionality throughout the course of the book. The PHP required is taught in context within each project so you can quickly learn how PHP integrates with MySQL to create powerful database-driven websites.

Each project is fully illustrated, so you will see clearly what you are building as you create your own database-driven website. You will build a form for registering users, and then build an interface so that an administrator can view and administer the user database. You will create a message board for users and a method for emailing them. You will also learn the best practices for ensuring that your website databases are secure. Later chapters describe how to create a blog, a product catalog, and a simple e-commerce site. You will also discover how to migrate a database to a remote host. Because you are building the interactive pages yourself, you will know exactly how the MySQL and PHP work, and you will be able to add database interactivity to your own websites with ease.

What you'll learn

  • Download and use a free development and test platform.

  • Create interactive database-driven websites.

  • Learn how to make website databases secure.

  • Create sophisticated projects, such as blogs and e-commerce sites.

  • Create user friendly and secure interfaces.

  • Migrate a site to a remote host.

  • Who this book is for

    Practical PHP and MySQL Website Databases is for web developers who wish to begin designing database-driven websites. The book is an excellent choice for people who have HTML and CSS skills but would also like to learn MySQL and PHP. For readers who have little or no knowledge of PHP, the book will teach enough PHP to complete all the projects in the book. Web developers who are ready to move beyond the basics or who have not kept up-to-date with their MySQL and PHP knowledge will also benefit from Practical PHP and MySQL Website Databases. College and university I.T. teachers will find that Practical PHP and MySQL Website Databases is an excellent set text, the projects would form a basis for students to adapt for their course work.

    Table of contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. CHAPTER 1: Create and Test a MySQL Database and Table
      1. Defining the Term Database
      2. Methods for Developing and Maintaining Databases
      3. Using XAMPP on Your Own Computer
      4. Summary
    10. CHAPTER 2: Create Web Pages That Interact with Users
      1. Create the Folder for Holding the Database Pages
      2. Create the Temporary Template
      3. Introducing the PHP include() Function
      4. Styling the Temporary Template
      5. The Interactive Version of the Template
      6. Connecting to the Database
      7. The PHP Keyword echo
      8. Styling the Form Fields
      9. Sticky Forms
      10. The Thank You Page
      11. Displaying Error Messages That Are Collected in an Array
      12. Viewing Members’ Records
      13. The View Users Page
      14. The Change Password Page
      15. Confirming a Successful Password Change
      16. Dealing with an Apostrophe
      17. Tutorial Dealing with the Apostrophe
      18. More About Arrays
      19. Summary
    11. CHAPTER 3: Login/Logout for Members and an Administrator
      1. Create the Logindb Database and Table
      2. Tidy the Styling
      3. Remove or Replace Redundant Menu Buttons in the Headers
      4. The Registration Page and Undesirable Characters
      5. Differentiating Between Two Types of Membership
      6. Create User Levels to Limit Access to Private Pages
      7. Log In
      8. A Members-only Page
      9. Planning the Administrator’s Role
      10. A New Header for the Administration Page
      11. The Administrator’s Page
      12. The Logout Page
      13. Testing the Login/logout Function
      14. Amending and Deleting Individual Records
      15. Summary
    12. CHAPTER 4: Display Membership Tables for the Administrator
      1. The Administration Database
      2. Revising the View Users Page to Include Editing and Deleting
      3. Displaying Pages of Records (Pagination)
      4. Planning the Search Criteria
      5. A Temporary Page for Displaying Specified Members
      6. The Search Form
      7. The Final Form Handler for Receiving Search Form Input
      8. Editing Records
      9. Summary
    13. CHAPTER 5: Register Addresses and Phone Numbers
      1. Create a New Database and a Table with 17 Columns
      2. The Importance of Documentation
      3. Extend the Registration Form, and Add a Pull-down Menu
      4. Add PayPal Debit/Credit Card Images
      5. Include PayPal on the Thank You Page
      6. Register Some Members
      7. Amend the Administrator’s Header
      8. Apply Pagination to the admin_view_users Table
      9. Searching and Editing Records
      10. Searching for Members’ Addresses and Phone Numbers
      11. Summary
    14. CHAPTER 6: The Finishing Touches
      1. Create the Database
      2. Create the Table by Importing an SQL Dump File
      3. Tidy the Folders and Filing System
      4. Degrees of Security
      5. Validation and Sanitization
      6. A More Secure Registration Page
      7. Search for an Address and Telephone Number
      8. Summary
    15. CHAPTER 7: Migrating to a Host and Backing Up Your Web Site Database
      1. Making Last-Minute Changes
      2. Safe E-mailing
      3. Migrating the Database and Tables to a Remote Host
      4. Back Up Your Database
      5. Summary
    16. CHAPTER 8: Creating a Product Catalog
      1. Prepare the Database and Administration Plan
      2. Create a New Database
      3. Create the File for Connecting to the Database
      4. Security
      5. Creating a Home Page with Search Capability
      6. Displaying the Catalog
      7. The Header for the Page of Search Results
      8. Creating the Admin/Add a House Page
      9. The Header for the Administrator’s Page
      10. Administrator’s View of the Entire Stock of Houses for Sale
      11. The Administrator’s Search Page
      12. The Contact Us Page
      13. Summary
    17. CHAPTER 9: Adding Multiple Tables and Other Enhancements
      1. Introduction to Multiple Tables
      2. Payments by Check
      3. Printing Online Forms
      4. Summary
    18. CHAPTER 10: Creating a Message Board
      1. The Plan
      2. Create the Database
      3. Create the Tables
      4. Create the Template for the Message Board Web Site
      5. Create the Registration Form
      6. Register Some Members
      7. The Login Page
      8. Logging Out
      9. Creating a Gateway to the Two Categories of Quotes
      10. The Form for Posting Quotations
      11. Processing the Postings
      12. Post Some Quotations
      13. The Home Page
      14. Adding Search Facilities
      15. The Header for View Posts.php
      16. Search for Specific Words or Phrases
      17. Displaying the Search Results
      18. Enhancing the Message Board
      19. Summary
    19. CHAPTER 11: E-Commerce: A Brief Introduction
      1. Items Common to Both Shopping Carts
      2. Features Applicable Only to the PayPal Shopping Cart
      3. A Custom Shopping Cart
      4. Summary
    20. CHAPTER 12: Troubleshooting Your Database-Driven Web Site
      1. HTML Code Errors
      2. PHP Script Errors
      3. MySQL Errors
      4. Summary
    21. APPENDIX: Appendix
      1. PHP Quick Reference
      2. MySQL and phpMyAdmin Quick Reference
      3. What Next?
      4. Resources for PHP and MySQL
      5. PHP and MySQL Internet Resources
      6. Summary
    22. Index

    Product information

    • Title: Practical PHP and MySQL Website Databases: A Simplified Approach
    • Author(s): Adrian W. West
    • Release date: December 2013
    • Publisher(s): Apress
    • ISBN: 9781430260769