Book description
This is the second edition of David Power's highly-respected PHP Solutions: Dynamic Web Design Made Easy. This new edition has been updated by David to incorporate changes to PHP since the first edition and to offer the latest techniques--a classic guide modernized for 21st century PHP techniques, innovations, and best practices.
You want to make your websites more dynamic by adding a feedback form, creating a private area where members can upload images that are automatically resized, or perhaps storing all your content in a database. The problem is, you're not a programmer and the thought of writing code sends a chill up your spine. Or maybe you've dabbled a bit in PHP and MySQL, but you can't get past baby steps. If this describes you, then you've just found the right book. PHP and the MySQL database are deservedly the most popular combination for creating dynamic websites. They're free, easy to use, and provided by many web hosting companies in their standard packages.
Unfortunately, most PHP books either expect you to be an expert already or force you to go through endless exercises of little practical value. In contrast, this book gives you real value right away through a series of practical examples that you can incorporate directly into your sites, optimizing performance and adding functionality such as file uploading, email feedback forms, image galleries, content management systems, and much more. Each solution is created with not only functionality in mind, but also visual design.
But this book doesn't just provide a collection of ready-made scripts: each PHP Solution builds on what's gone before, teaching you the basics of PHP and database design quickly and painlessly. By the end of the book, you'll have the confidence to start writing your own scripts or--if you prefer to leave that task to others--to adapt existing scripts to your own requirements. Right from the start, you're shown how easy it is to protect your sites by adopting secure coding practices.
Table of contents
- Copyright
- About the Author
- About the Technical Reviewers
- Acknowledgments
- Introduction
- 1. What Is PHPâAnd Why Should I Care?
-
2. Getting Ready to Work with PHP
- 2.1. Checking whether your website supports PHP
- 2.2. What you need for a local test environment
- 2.3. Setting up on Windows
- 2.4. Setting up on Mac OS X
- 2.5. Checking your PHP settings (Windows and Mac)
- 2.6. Where to locate your PHP files
- 2.7. What's next?
-
3. How to Write PHP Scripts
-
3.1. PHP: The big picture
- 3.1.1. Telling the server to process PHP
- 3.1.2. Embedding PHP in a web page
- 3.1.3. Storing PHP in an external file
- 3.1.4. Using variables to represent changing values
- 3.1.5. Ending commands with a semicolon
- 3.1.6. Commenting scripts
- 3.1.7. Using arrays to store multiple values
- 3.1.8. PHP's built-in superglobal arrays
- 3.1.9. Understanding when to use quotes
- 3.1.10. Making decisions
- 3.1.11. Making comparisons
- 3.1.12. Using indenting and whitespace for clarity
- 3.1.13. Using loops for repetitive tasks
- 3.1.14. Using functions for preset tasks
- 3.1.15. Understanding PHP classes and objects
- 3.1.16. Displaying PHP output
- 3.1.17. Understanding PHP error messages
-
3.2. PHP: A quick reference
- 3.2.1. Using PHP in an existing website
- 3.2.2. Data types in PHP
- 3.2.3. Doing calculations with PHP
- 3.2.4. Adding to an existing string
- 3.2.5. All you ever wanted to know about quotesâand more
- 3.2.6. Creating arrays
- 3.2.7. The truth according to PHP
- 3.2.8. Creating loops
- 3.2.9. Modularizing code with functions
- 3.3. PHP quick checklist
-
3.1. PHP: The big picture
-
4. Lightening Your Workload with Includes
-
4.1. Including code from external files
- 4.1.1. Introducing the PHP include commands
- 4.1.2. Where PHP looks for include files
- 4.1.3. Choosing the right filename extension for includes
- 4.1.4. Creating pages with changing content
- 4.1.5. Preventing errors with include files
- 4.1.6. Choosing where to locate your include files
- 4.1.7. Adjusting your include_path
- 4.1.8. Why can't I use site-root-relative links with PHP includes?
- 4.1.9. Security considerations with includes
- 4.2. Chapter review
-
4.1. Including code from external files
-
5. Bringing Forms to Life
- 5.1. How PHP gathers information from a form
- 5.2. Processing and validating user input
- 5.3. Sending email
- 5.4. Handling multiple-choice form elements
- 5.5. Chapter review
-
6. Uploading Files
- 6.1. How PHP handles file uploads
- 6.2. Uploading files
- 6.3. Creating a PHP file upload class
- 6.4. Uploading multiple files
- 6.5. Using the upload class
- 6.6. Points to watch with file uploads
- 6.7. Chapter review
- 7. Using PHP to Manage Files
-
8. Generating Thumbnail Images
- 8.1. Checking your server's capabilities
-
8.2. Manipulating images dynamically
-
8.2.1. Making a smaller copy of an image
- 8.2.1.1. Getting ready
- 8.2.1.2. Building the Ps2_Thumbnail class
- 8.2.1.3. PHP Solution 8-1: Getting the image details
- 8.2.1.4. PHP Solution 8-2: Creating the setter methods
- 8.2.1.5. PHP Solution 8-3: Final preparations for generating the thumbnail
- 8.2.1.6. PHP Solution 8-4: Generating the thumbnail image
-
8.2.1. Making a smaller copy of an image
- 8.3. Resizing an image automatically on upload
- 8.4. Chapter summary
- 9. Pages That Remember: Simple Login and Multipage Forms
-
10. Getting Started with MySQL
- 10.1. Why MySQL?
- 10.2. How a database stores information
- 10.3. Using MySQL with a graphical interface
- 10.4. Setting up the phpsols database
- 10.5. Choosing the right data type in MySQL
- 10.6. Chapter review
-
11. Connecting to MySQL with PHP and SQL
- 11.1. Checking your remote server setup
- 11.2. How PHP communicates with MySQL
-
11.3. Using SQL to interact with a database
- 11.3.1. Writing SQL queries
- 11.3.2. Refining the data retrieved by a SELECT query
-
11.3.3. Understanding the danger of SQL injection
- 11.3.3.1. PHP Solution 11-6: Inserting an integer from user input into a query
- 11.3.3.2. PHP Solution 11-7: Inserting a string with real_escape_string()
- 11.3.3.3. Embedding variables in MySQLi prepared statements
- 11.3.3.4. PHP Solution 11-8: Using a MySQLi prepared statement in a search
- 11.3.3.5. Embedding variables in PDO prepared statements
- 11.3.3.6. PHP Solution 11-9: Using a PDO prepared statement in a search
- 11.3.3.7. PHP Solution 11-10: Changing column options through user input
- 11.4. Chapter review
-
12. Creating a Dynamic Online Gallery
- 12.1. Why not store images in a database?
- 12.2. Planning the gallery
- 12.3. Converting the gallery elements to PHP
- 12.4. Building the dynamic elements
- 12.5. Chapter review
-
13. Managing Content
- 13.1. Setting up a content management system
- 13.2. Reviewing the four essential SQL commands
- 13.3. Security and error messages
- 13.4. Chapter review
-
14. Formatting Text and Dates
- 14.1. Displaying a text extract
-
14.2. Let's make a date
- 14.2.1. How MySQL handles dates
- 14.2.2. Inserting dates into MySQL
-
14.2.3. Working with dates in PHP
- 14.2.3.1. Setting the default time zone
- 14.2.3.2. Creating a DateTime object
- 14.2.3.3. Formatting dates in PHP
- 14.2.3.4. Creating a DateTime object from a custom format
- 14.2.3.5. Choosing between date() and the DateTime class
- 14.2.3.6. Using the DateTimeZone class
- 14.2.3.7. Adding and subtracting set periods with the DateInterval class
- 14.2.3.8. Finding the difference between two dates with the diff() method
- 14.2.3.9. Calculating recurring dates with the DatePeriod class
- 14.3. Chapter review
-
15. Pulling Data from Multiple Tables
- 15.1. Understanding table relationships
- 15.2. Linking an image to an article
- 15.3. Chapter review
-
16. Managing Multiple Database Tables
- 16.1. Maintaining referential integrity
- 16.2. Inserting records into multiple tables
- 16.3. Updating and deleting records in multiple tables
- 16.4. Chapter review
- 17. Authenticating Users with a Database
Product information
- Title: PHP Solutions: Dynamic Web Design Made Easy, Second Edition
- Author(s):
- Release date: November 2010
- Publisher(s): friends of ED
- ISBN: 9781430232490
You might also like
book
PHP Solutions: Dynamic Web Design Made Easy, Third Edition
This is the third edition of David Powers' highly-respected PHP Solutions: Dynamic Web Design Made Easy. …
book
PHP Solutions: Dynamic Web Design Made Easy
You want to make your websites more dynamic by adding a feedback form, creating a private …
book
PHP 7 Solutions: Dynamic Web Design Made Easy
Make your websites more dynamic by adding a feedback form, creating a private area where members …
video
Dynamic Web Design with PHP and MySQL
In this PHP - MYSQL training course you will learn how to leverage PHP and MySQL …