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. The Missing Credits 9 Introduction 13 Part One: PHP and MySQL Basics 21 Chapter 1: PHP: What, Why, and Where? 23 Gathering Your Tools 23 Writing Your First Program 34 Running Your First Program 36 Writing Your Second Program 37 Upload Your HTML, CSS, and PHP 40 Running Your Second Program 41 Chapter 2: PHP Syntax: Weird and Wonderful 45 Get Information from a Web Form 45 Working with Text in PHP 52 The $_REQUEST Variable 66 What Do You Do with User Information? 73 Chapter 3: MySQL and SQL: Database and Language 75 What Is a Database? 75 Installing MySQL 79 SQL Is a Language for Talking to Databases 96 Part Two: Dynamic Web Pages 109 Chapter 4: Connecting PHP to MySQL 111 Writing a Simple PHP Connection Script 111 Cleaning Up Your Code with Multiple Files 123 Building a Basic SQL Query Runner 129 Chapter 5: Better Searching with Regular Expressions 147 String Matching, Double-Time 148 Chapter 6: Generating Dynamic Web Pages 163 Revisiting a User’s Information 163 Planning Your Database Tables 165 Saving a User’s Information 171 Show Me the User 179 Redirection and Revisitation of Creating Users 196 Part Three: From Web Pages to Web Applications 209 Chapter 7: When Things Go Wrong (and They Will) 211 Planning Your Error Pages 212 Finding a Middle Ground for Error Pages with PHP 219 Add Debugging to Your Application 227 Redirecting on Error 236 Chapter 8: Handling Images and Complexity 247 Images Are Just Files 248 Images Are For Viewing 269 And Now for Something Completely Different 278 Chapter 9: Binary Objects and Image Loading 279 Storing Different Objects in Different Tables 280 Inserting a Raw Image into a Table 282 Your Binary Data Isn’t Safe to Insert...Yet 286 Connecting Users and Images 293 Show Me the Image 303 Embedding an Image Is Just Viewing an Image 313 So Which Approach is Best? 318 Chapter 10: Listing, Iterating, and Administrating 321 Some Things Never Change 322 Listing All Your Users 325 Deleting a User 333 Talking Back To Your Users 341 Standardizing on Messaging 351 Integrating Utilities, Views, and Messages 358 Part Four: Security and the Real World 371 Chapter 11: Authentication and Authorization 373 Start with Basic Authentication 374 Abstracting What’s the Same 384 Passwords Don’t Belong in PHP Scripts 387 Passwords Create Security, But Should Be Secure 402 Chapter 12: Cookies, Sign-ins, and Ditching Crummy Pop-ups 409 Going Beyond Basic Authentication 410 Logging In with Cookies 416 Adding Context-Specific Menus 433 Chapter 13: Authorization and Sessions 447 Modeling Groups in Your Database 448 Checking for Group Membership 454 Group-Specific Menus 463 Entering Browser Sessions 467 Memory Lane: Remember that Phishing Problem? 479 So Why Ever Use Cookies? 483 Index 485 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. 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. 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 a Provides information on using PHP and MySQL to build and manage database-driven websites