Missing manual php mysql

PHP & MySQL: The Missing Manual

PHP & MySQL: The Missing Manual

Read it now on the O’Reilly learning platform with a 10-day free trial.

O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Book description

If you can build websites with CSS and JavaScript, this book takes you to the next level—creating dynamic, database-driven websites with PHP and MySQL. Learn how to build a database, manage your content, and interact with users through queries and web forms. With step-by-step tutorials, real-world examples, and jargon-free explanations, you’ll soon discover the power of server-side programming.

The important stuff you need to know:

  • Get a running start. Write PHP scripts and create a web form right away.
  • Learn the language. Get up to speed on PHP and SQL syntax quickly.
  • Build a database. Use MySQL to store user information and other data.
  • Make it dynamic. Create pages that change with each new viewing.
  • Be ready for mistakes. Plan error messages to help direct users.
  • Manage your content. Use the file system to access user data, including images and other binary files.
  • Control operations. Create an administrative interface to oversee your site.

Publisher resources

Table of contents

  1. A Note Regarding Supplemental Files
  2. The Missing Credits
    1. About the Author
    2. About the Creative Team
    3. Acknowledgments
    4. The Missing Manual Series
    1. What Is PHP?
      1. PHP Is All About the Web
      2. JavaScript Is Loose, PHP Is…Less So
      3. PHP Is Interpreted
      1. Macintosh and Windows
      2. FTP: It’s Critical
      3. About the Outline
      1. Missing CD
      2. Registration
      3. Feedback
      4. Errata
      1. 1. PHP: What, Why, and Where?
        1. Gathering Your Tools
          1. PHP on the PC
          2. PHP on the Mac
          3. Get Out Your Text Editor
          1. Start with an HTML Page
          2. Write a PHP Script
          3. Variables Vary
          1. Get Information from a Web Form
            1. Access Request Parameters Directly
            2. Create Your Own Variables
            1. Combining Text
            2. Searching Within Text
            3. Changing Text
            4. Trimming and Replacing Text
              1. Remove Extra White Space with trim()
              2. Replace Characters in Text with str_replace()
              1. Arrays Can Hold Multiple Values
              2. Working with $_REQUEST as an Array
              1. What Is a Database?
                1. Databases Are Persistent
                2. Databases Are All About Structure
                3. (Good) Databases Are Relational
                1. MySQL on Windows
                2. MySQL on Mac OS X
                3. Running Your First SQL Query
                1. Logging In to Your Web Server’s Database
                2. USE a Database
                3. Making Tables with CREATE
                4. Deleting Tables with DROP
                5. INSERT a Few Rows
                6. SELECT for the Grand Finale
                1. 4. Connecting PHP to MySQL
                  1. Writing a Simple PHP Connection Script
                    1. Connecting to a MySQL Database
                    2. Selecting the Database to USE
                    3. SHOW Your Database’s Tables
                      1. Handling Errors By Seeing If Your Results are Not
                      2. Printing Out Your SQL Results
                      1. Replacing Hand-Typed Values with Variables
                      2. Abstracting Important Values into a Separate File
                      3. Variables Vary, But Constants Stay Constant
                      1. Creating an HTML Form with a Big Empty Box
                      2. Connecting to Your Database (Again)
                      3. Running Your User’s SQL Query (Again)
                      4. Entering Your First Web-Based Query
                      5. Handling Queries That Don’t SELECT Information
                      6. Dealing with Humans
                      7. Avoid Changing User Input Whenever Possible
                      1. String Matching, Double-Time
                        1. A Simple String Searcher
                        2. Search for One String…Or Another
                        3. Get into Position
                        4. Ditching trim and strtoupper
                        5. Searching for Sets of Characters
                        6. Regular Expressions: To Infinity and Beyond
                        1. Revisiting a User’s Information
                        2. Planning Your Database Tables
                          1. Good Database Tables Have id Columns
                          2. Auto-Increment Is Your Friend
                            1. IDs and Primary Keys are Good Bedfellows
                            1. Building Your SQL Query
                            2. Inserting a User
                            3. A First Pass at Confirmation
                            4. Users Are Users, Not Programmers
                            1. Mocking Up a User Profile Page
                            2. Changing a Table’s Structure with ALTER
                            3. Building Your Script: First Pass
                            4. SELECT a User From Your Database
                            5. Pulling Values From a SQL Query Result
                            6. Getting a User ID into show_user.php
                            1. Updating Your User Signup Form
                            2. Updating Your User Creation Script
                            3. Rounding Things Out with Regular Expressions (Again)
                            1. 7. When Things Go Wrong (and They Will)
                              1. Planning Your Error Pages
                                1. What Should Users See?
                                  1. Tell Your Users that a Problem has Occurred
                                  2. Use the Appropriate Tone for Your Error Message
                                  1. Creating a PHP Error Page
                                  2. Testing out Your Faulty Solution
                                  3. Expect the Unexpected
                                  4. Welcome to Security and Phishing
                                    1. Phishing and Subtle Redirection
                                    2. The Dangers of Request Parameters
                                    1. Turn on PHP Error Reporting
                                      1. Set Error Reporting Globally
                                      2. Turn Off Error Reporting When You Go to Production
                                      1. Updating Your Script to Use show_error.php
                                      2. Simplify and Abstract
                                      3. redirect is Path-Insensitive
                                      1. Images Are Just Files
                                        1. HTML Forms Can Set the Stage
                                        2. Uploading a User’s Image to Your Server
                                          1. Setting Up Some Helper Variables
                                          2. Did the File Upload with Any Errors?
                                          3. Is this Really an Uploaded File?
                                          4. Is the Uploaded File Really an Image?
                                          5. Moving the File to a Permanent Location
                                          1. Creating a New Database Column
                                          2. Inserting the Image Path into Your Table
                                          3. Checking Your Work
                                          1. SELECT the Image and Display It
                                          2. Converting File System Paths to URLs
                                          3. Displaying Your User’s Image: Take Two
                                          4. A Few Quick Revisions to app_config.php
                                          1. Storing Different Objects in Different Tables
                                          2. Inserting a Raw Image into a Table
                                            1. getimagesize Doesn’t Return a File Size
                                            2. file_get_contents Does What You Think It Does
                                            3. INSERT the Image
                                            1. Printing a String to a Variable
                                            2. Getting the Correct ID Before Redirecting
                                            1. Inserting an Image, then Inserting a User
                                            2. Joining Tables with WHERE
                                              1. Connect Your Tables Through Common Columns
                                              2. Alias Your Tables (and Columns)
                                              1. Displaying an Image
                                                1. Game Plan Your Script
                                                2. Get the Image ID
                                                3. Build and Run a Select Query
                                                4. Get the Results, Get the Image, and Deal with Potential Errors
                                                5. Tell the Browser What’s Coming
                                                6. Send the Image Data
                                                1. All You Need is an Image ID
                                                2. A Script Can Be an Image src
                                                1. OK, If You Insist on an Answer…
                                                1. Some Things Never Change
                                                  1. (User Interface) Brevity is Still the Soul of Wit
                                                  2. Wish Lists are Good, Too
                                                  1. SELECTing What You Need (Now)
                                                  2. Building a Simple Admin Page
                                                  3. Iterating Over Your Array
                                                  1. Surveying the Individual Components
                                                  2. Putting It All Together
                                                  3. Deleting Users Shouldn’t Be Magical
                                                    1. Start with a Little Javascript
                                                    2. Finish with a Change in Linking
                                                    1. redirect Has Some Limitations
                                                    2. JavaScript alert Redux
                                                      1. An All-Javascript Approach
                                                      2. Your PHP Controls Your Output
                                                      1. Building a New Utility Function for Display
                                                      2. Duplicate Code is a Problem Waiting to Happen
                                                      3. View and Display Code Belongs Together
                                                      1. Calling Repeated Code from a View Script
                                                      2. Flexible Functions are Better Functions
                                                        1. Use Default Argument Values in Display_Messages
                                                        2. Outputting a Standard Header with Heredoc
                                                        3. Updating Your Script(S) to Use Display_Head
                                                        1. 11. Authentication and Authorization
                                                          1. Start with Basic Authentication
                                                            1. Basic Authentication Using HTTP Headers
                                                            2. Basic Authentication is…Pretty Basic
                                                            3. The Worst Authentication Ever
                                                            4. Get Your User’s Credentials
                                                            5. Cancel is Not a Valid Means of Authentication
                                                            6. Get Your User’s Credentials (Really!)
                                                            1. Another Utility Script: authorize.php
                                                            1. Updating the users Table
                                                            2. Deal with Newly Invalid Data
                                                            3. You Need to Get an Initial Username and Password
                                                            4. Inserting the User’s Username and Password
                                                            5. Connect authorize.php to Your users Table
                                                            1. Encrypt Text with the crypt Function
                                                            2. crypt is One-Way Encryption
                                                            3. Encryption Uses Salt
                                                            1. Going Beyond Basic Authentication
                                                              1. Starting with a Landing Page
                                                              2. Taking Control of User Sign-ins
                                                              3. From HTTP Authentication to Cookies
                                                                1. What is a Cookie?
                                                                2. Create and Retrieve Cookies
                                                                1. Is the User is Already Signed In?
                                                                2. Is the User Trying to Sign In?
                                                                3. Displaying the page
                                                                4. Redirecting as Needed
                                                                5. Logging the User In
                                                                6. Blank Pages and Expiring Cookies
                                                                7. Errors Aren’t Always Interruptive
                                                                8. An Option for Repeat Attempts
                                                                1. Putting a Menu Into Place
                                                                2. From HTML to Scripts
                                                                  1. Any HTML File Can Be Converted to PHP
                                                                  2. Challenge: Be Self-Referential with User Creation
                                                                  1. Modeling Groups in Your Database
                                                                    1. Adding a Groups Table
                                                                    2. The Many-to-Many Relationship
                                                                      1. One-to-One, One-to-Many, Many-to-Many
                                                                      2. Joins are Best Done with IDs
                                                                      3. Using a Join Table to Connect Users with Groups
                                                                      1. authorize.php Needs a Function
                                                                      2. Taking in a List of Groups
                                                                      3. Iterating Over Each Group
                                                                      4. Allow, Deny, Redirect
                                                                      1. Sessions are Server-Side
                                                                      2. Sessions Must Be Started
                                                                      3. From $_COOKIE to $_SESSION
                                                                      4. Sessions Must be Restarted, Too
                                                                      5. $_REQUEST Doesn’t Include $_SESSION
                                                                      6. Menu, Anyone?
                                                                      7. And Then Sign Out…

                                                                      Product information

                                                                      • Title: PHP & MySQL: The Missing Manual
                                                                      • Author(s): Brett McLaughlin
                                                                      • Release date: November 2011
                                                                      • Publisher(s): O’Reilly Media, Inc.
                                                                      • ISBN: 9780596515867

                                                                      You might also like

                                                                      Check it out now on O’Reilly

                                                                      Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.

                                                                      Источник

                                                                      PHP & MySQL: The Missing Manual, 2nd Edition

                                                                      PHP & MySQL: The Missing Manual, 2nd Edition

                                                                      Read it now on the O’Reilly learning platform with a 10-day free trial.

                                                                      O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

                                                                      Book description

                                                                      If you can build websites with CSS and JavaScript, this book takes you to the next level—creating dynamic, database-driven websites with PHP and MySQL. Learn how to build a database, manage your content, and interact with users. With step-by-step tutorials, this completely revised edition gets you started with expanded coverage of the basics and takes you deeper into the world of server-side programming.

                                                                      The important stuff you need to know:

                                                                      • Get up to speed quickly. Learn how to install PHP and MySQL, and get them running on both your computer and a remote server.
                                                                      • Gain new techniques. Take advantage of the all-new chapter on integrating PHP with HTML web pages.
                                                                      • Manage your content. Use the file system to access user data, including images and other binary files.
                                                                      • Make it dynamic. Create pages that change with each new viewing.
                                                                      • Build a good database. Use MySQL to store user information and other data.
                                                                      • Keep your site working. Master the tools for fixing things that go wrong.
                                                                      • Control operations. Create an administrative interface to oversee your site.

                                                                      Источник

                                                                      Читайте также:  Php curl parsing html
Оцените статью