Practical PHP 7, MySQL 8, and MariaDB Website Databases - Adrian W. West, Steve Prettyman

Practical PHP 7, MySQL 8, and MariaDB Website Databases (eBook)

A Simplified Approach to Developing Database-Driven Websites
eBook Download: PDF
2018 | 2nd ed.
XX, 546 Seiten
Apress (Verlag)
978-1-4842-3843-1 (ISBN)
Systemvoraussetzungen
66,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
Build interactive, database-driven websites with PHP 7, MySQL 8, and MariaDB. The focus of this book is on getting you up and running as quickly as possible with real-world applications. In the first two chapters, you will set up your development and testing environment, and then build your first PHP and MariaDB or 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 MariaDB and 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 product catalog, and a simple e-commerce site. You will also discover how to migrate a database to a remote host. The final chapter will demonstrate the advantages of migrating to Oracle's MySQL 8. You will be shown step by step migration directions along with a demonstration of the tools available in SQL Workbench.
 
Because you are building the interactive pages yourself, you will know exactly how MySQL, MariaDB, and PHP all work together, and you will be able to add database interactivity to your own websites with ease.

What You Will Learn
  • Build a secure database-driven website using PHP 7, MySQL 8, and MariaDB
  • Create a product catalog
  • Write a message board
  • Move towards e-commerce
  • Employ security and validation measures
  • Migrate to Oracle's MySQL 8 Server platform
Who This Book Is For
 
Web developers with HTML, CSS and a limited Bootstrap experience. Readers need little to no prior experience with PHP and MySQL.




Adrian W. West is an active web design and development consultant at amwebdesign.co.uk.  He also writes monthly computer help articles in two local magazines. Adrian is the author of Practical HTML5 Projects, also published by Apress. Frustrated by the over-complicated MySQL manuals that assumed the reader would fill in the many gaps in the instructions, he researched, tested and developed a fully explained and simplified method to eliminate the difficulties he experienced; this book is the result.

Steve Prettyman earned his bachelor of arts degree in education from Oglethorpe University in 1979. He quickly began his teaching career as a high school mathematics instructor while continuing his education by earning a master's degree in business information systems from Georgia State University (1985). Since then, Steve has spent over 30 years in the IT industry. The last, almost 20 years, he has been an instructor and professor at Chattahoochee Technical College, Kennesaw State University, and Southern Polytechnic State University. He is currently the Computer Science Department Chair for Florida Keys Community College, Key West, Florida. His primary teaching responsibilities include programming, web design, and web application development.

Build interactive, database-driven websites with PHP 7, MySQL 8, and MariaDB. The focus of this book is on getting you up and running as quickly as possible with real-world applications. In the first two chapters, you will set up your development and testing environment, and then build your first PHP and MariaDB or 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 MariaDB and 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 product catalog, and a simple e-commerce site. You will also discover how to migrate a database to a remote host. The final chapter will demonstrate the advantages of migrating to Oracle's MySQL 8. You will be shown step by step migration directions along with a demonstration of the tools available in SQL Workbench. Because you are building the interactive pages yourself, you will know exactly how MySQL, MariaDB, and PHP all work together, and you will be able to add database interactivity to your own websites with ease.What You Will LearnBuild a secure database-driven website using PHP 7, MySQL 8, and MariaDBCreate a product catalogWrite a message boardMove towards e-commerceEmploy security and validation measuresMigrate to Oracle's MySQL 8 Server platformWho This Book Is For Web developers with HTML, CSS and a limited Bootstrap experience. Readers need little to no prior experience with PHP and MySQL.

Adrian W. West is an active web design and development consultant at amwebdesign.co.uk.  He also writes monthly computer help articles in two local magazines. Adrian is the author of Practical HTML5 Projects, also published by Apress. Frustrated by the over-complicated MySQL manuals that assumed the reader would fill in the many gaps in the instructions, he researched, tested and developed a fully explained and simplified method to eliminate the difficulties he experienced; this book is the result.Steve Prettyman earned his bachelor of arts degree in education from Oglethorpe University in 1979. He quickly began his teaching career as a high school mathematics instructor while continuing his education by earning a master’s degree in business information systems from Georgia State University (1985). Since then, Steve has spent over 30 years in the IT industry. The last, almost 20 years, he has been an instructor and professor at Chattahoochee Technical College, Kennesaw State University, and Southern Polytechnic State University. He is currently the Computer Science Department Chair for Florida Keys Community College, Key West, Florida. His primary teaching responsibilities include programming, web design, and web application development.

Contents 4
About the Authors 14
Acknowledgments 15
Introduction 16
Chapter 1: Create and Test a Database and Table 20
Defining Developer, Administrator, and User 21
Defining Interactive Websites 21
Using MariaDB or MySQL Only for Interactive Database Tables 22
Methods for Developing and Maintaining Databases 22
A Brief Look Inside Web Server Communication 22
A Free Development Platform for Testing 24
Using XAMPP on Your Own Computer 24
Will I Be Able to Transfer the Database from XAMPP or EasyPHP to a Remote Host? 25
Downloading and Installing XAMPP 25
Starting XAMPP 28
Closing XAMPP 29
Where Is MariaDB and MySQL 8? 30
Using EasyPHP on Your Own Computer 31
Download and Install EasyPHP 31
Starting EasyPHP 31
Closing EasyPHP 32
phpMyAdmin Security 32
Accessing phpMyAdmin Directly 36
The Familiar Bits 37
Planning a Database: The Essential First Step 39
Creating a Database Using phpMyAdmin 40
Create a Table Using phpMyAdmin 43
The SQL Alternative 46
Deleting Databases and Tables 49
Summary 50
Chapter 2: Create Web Pages That Interact with Users 51
Creating the Folder for Holding the Database Pages 52
Creating the Temporary Template 52
Introducing the PHP include() Function 54
The Included Header File 55
The Included Menu File 57
The Included Information Column 58
The Included Footer File 59
How Does the Server Process the Page? 60
The Interactive Version of the Template 60
Connecting to the Database 62
Explanation of the Code 63
The Registration Page 65
Explanation of the Code 68
Explanation of the Code 72
The PHP Keyword echo 76
The “Thank You” Page 76
Displaying Error Messages That Are Collected in an Array 78
Hashing the Password 79
Viewing Members’ Records 79
The View Users Page 79
Explanation of the Code 82
The Change Password Page 83
Explanation of the Code 85
Explanation of the Code 87
Confirming a Successful Password Change 90
Testing the Tutorial’s Pages 90
More About Arrays 91
Summary 92
Chapter 3: Create Login/Logout Functionality for Members and an Administrator 93
Creating the logindb Database and users Table 94
Removing or Replacing Redundant Menu Buttons in the Headers 95
Adding a Login Button to the Home Page Header 96
Removing Redundant Buttons from the Registration and New Password Headers 97
The Revised Registration Page 97
The New Header for the New Password Page 98
A New Header Menu for the Members page 100
Amend the Header for the “Thank You” Page 100
The Registration Page and Undesirable Characters 102
Explanation of the Code 104
Registering Some Members 105
Differentiating Between Two Types of Membership 106
Creating User Levels to Limit Access to Private Pages 106
Log In 109
The Header for the Login Page 109
The Login Page 110
Explanation of the Code 112
Explanation of the Code 114
Sessions 117
A Members-Only Page 119
Explanation of the Code 121
Planning the Administrator’s Role 122
A New Header for the Administration Page 123
The Administrator’s Page 124
Explanation of the Code 125
The Logout Page 125
Explanation of the Code 126
Testing the Login/Logout Function 127
Amending and Deleting Individual Records 127
Summary 128
Chapter 4: Create an Administration Interface 129
The Administration Database 129
The Users Table 131
Revising the View Users Page to Include Editing and Deleting 133
Explanation of the Code 136
Displaying Pages of Records (Pagination) 139
Explanation of the Code 143
Planning the Search Criteria 146
A Temporary Search Page for Displaying Specified Members 146
Explanation of the Code 149
The Search Form 150
Explanation of the Code 152
The Final Form Handler for Receiving Search Form Input 153
Explanation of the Code 155
Editing Records 157
Explanation of the Code 160
Deleting Records 163
Explanation of the Code 166
Summary 168
Chapter 5: Expand and Enrich Your Website 169
Creating a New Database, a Table with 15 Columns, and a Price Table 169
Creating the File for Connecting to the Database 170
Creating the Tables 171
Using ENUM 172
The Importance of Documentation 172
Extending the Registration Form and Adding a Pull-Down Menu 174
Always Announce Prices and Fee Payments Up-Front 175
Explanation of the Code 180
Explanation of the Code 185
Adding PayPal Debit/Credit Card Images 186
Including PayPal on the “Thank You” Page 186
Explanation of the Code 190
Registering Some Members 191
A Small Amendment to the Login Page 193
Amending the Administrator’s Header 193
Adding Class and Paid to the admin_view_users Table 195
Explanation of the Code 198
Searching and Editing Records 199
Explanation of the Code 202
Modifying the Form for Editing Records 202
Summary 208
Chapter 6: Add the Finishing Touches: Security and Validation 209
Creating the Database 209
Creating the File for Connecting to the Database 210
Creating the users Table by Importing a SQL Dump File 211
Registering Some Members Manually 213
Adding a Title Column to the users Table 215
Creating the Prices Table by Importing a SQL Dump File 217
Tidying Up the Folders and Filing System 218
Degrees of Security 218
Adding a Layer of Security 218
An Increased Layer of Protection 220
Validation and Sanitization 220
The filter_var() Function 220
Validation 220
Sanitization 222
Validating Telephone Numbers 223
A Safer Registration Page 223
Explanation of the Code 231
Explanation of the Code 238
Searching for a Title, an Address, or a Telephone Number 239
Explanation of the Code 242
Viewing the Retrieved Title, Address, and Phone Number 243
Explanation of the Code 245
Editing the Title, Addresses, and Telephone Numbers 246
Explanation of the Code 253
Summary 254
Chapter 7: Migrate to a Host and Back Up Your Website Database 255
Making Last-Minute Changes 255
Creating a New Database 256
Details of the Downloaded File for Connecting to the Database 257
Allowing Members to Update Their Own Records 258
Explanation of the Code 270
A Secure Feedback Form 272
What Does a Feedback Reply Look Like? 272
The Feedback Form 273
Explanation of the Code 278
Explanation of the Code 282
The “Thank You” Page and the Error Messages 284
A Common Header 287
Explanation of the Code 289
Logging Exceptions and Error 290
Migrating the Database and Tables to a Remote Host 292
A Puzzling Error Message 293
Creating and Exporting the SQL File 293
To Create a Dump File of a Table or Tables 293
What Does a SQL Dump Look Like? 295
Investigate the Remote Host’s Server 298
Using the GUIs on a Remote Host’s Server 299
Connecting to the Database on the Remote Host 300
Securely Uploading the mysqli_connection.php File 301
Uploading the Interactive Pages to the Host 303
Backing Up Your Database 304
Summary 304
Chapter 8: Create a Product Catalog 305
Preparing the Database and Administration Plan 305
Creating a New Database 306
Creating the File for Connecting to the Database 307
Security 308
Creating a Home Page with Search Capability 310
The Header for the Majority of the Pages 311
The Home Page Code 312
Displaying the Catalog 314
Explanation of the Code 320
The Header for the Page of Search Results 321
Creating the House Details Page 322
Explanation of Code 326
Creating the Admin/Adding a House Page 327
The Header for the Administrator’s Page 336
Administrator’s View of the Entire Stock of Houses for Sale 338
The Administrator’s Search Page 343
The Result of a Search 345
The Contact Us Page 346
Summary 352
Chapter 9: Join Multiple Tables and Other Enhancements 353
Introduction to Multiple Tables 353
Normalization 354
Creating the Database and Tables 355
Viewing the Connection File 356
Creating a Second Table 357
Foreign Keys 357
Preparing the Tables for Joining 357
Populating the Two Tables 358
Joining Data from the Two Tables 360
Creating the Third Table 363
Creating Pages to Display the Data from Your Joined Tables 365
The Home Page 365
The Main Menu for the Pages 367
The Header for All the Pages 368
The Page for Viewing the Birds 369
Explanation of the Code 373
The Page for Viewing the Locations and Habitats of the Reserves 373
Displaying Data from the Joined Tables 376
Creating a Page to Display the Three Joined Tables 380
Explanation of the Code 384
Payments by Check 384
A Choice of Payment Method 385
The Check Payment 389
Explanation of the Code 392
Printing Online Forms 393
Summary 394
Chapter 10: Create a Message Board 395
The Plan 395
Creating the Database 396
Creating the Tables 396
Creating the Second Table 397
Creating the Registration Form 403
The “Thank You” Page 411
Populating the Members Table 412
The Login Page 413
Explanation of the Code 415
Logging Out 418
Creating a Gateway to a Choice of Quotes 418
The Form for Posting Quotations 420
Explanation of the Code 423
Processing the Postings 424
Explanation of the Code 425
Posting Some Quotations 426
The Comical Quotes Page 427
Explanation of the Code 429
The Header for the Comical Quotes Page 430
The Wise Quotes Page 431
Explanation of the Code 433
The Header for the Wise Quotes Page 434
Adding Search Facilities 435
Explanation of the Code 437
The Header for ViewPosts.php 438
Searching for Specific Words or Phrases 439
The Full Text Search Form 440
Displaying the Search Results 442
Explanation of the Code 444
The Header for the quotes_found Page 445
Enhancing the Message Board 446
Converting the Message Board to a Forum 446
Summary 447
Chapter 11: E-commerce: A Brief Introduction 448
Security Warning 450
The Plan 450
Creating the PayPal Cart Site 451
Creating the PayPal Cart Database and Tables 451
Viewing the Connection File 452
Populating the PayPal Cart Tables 452
The PayPal Cart Home Page 455
Using the PayPal Cart Home Page to Search for Paintings 458
Explanation of the Code 460
Integrating with the PayPal Shopping Cart Buttons 461
Explanation of the Code 467
Creating a Custom Cart 467
The Custom Cart Home Page 469
Create the Custom Cart Database and Tables 469
Exploring the Custom Shopping Cart 471
The Custom Cart Login Page 473
Explanation of the Code 477
Retrieving a Forgotten Password 477
Explanation of the Code 480
The Custom Cart Search Page 481
Adding Paintings to a Table for a Custom Shopping Cart 482
Explanation of the Code 486
Explanation of the Code 489
Explanation of the Code 493
The Checkout Page 494
The Additional Administrative Tasks 494
Summary 495
Chapter 12: Take a Brief Look at Oracle MySQL 8 496
Advantages of Upgrading 496
Installing MySQL 8 Community Server 498
Exploring the Features of MySQL Workbench 505
Connecting PHP 7 to the MySQL 8 Community Server 512
Migrating to MySQL 8 Community Server 515
Using Our PHP Files with MySQL 8 Community Server 519
Summary 522
Appendix A: Troubleshooting 523
Browser Quirks 524
Tables Not Displaying 524
A Style Change Has No Effect 525
Included Items Missing from the Display 525
A Page Fails to Validate 525
A PayPal Pull-Down Menu Does Not Work 525
Access Denied 525
PHP Error Levels 526
Call to an Undefined Function 526
Cannot Redeclare Function 526
Undefined Index or Undefined Variable 526
Empty Variable Value 527
Headers Already Sent 527
Blank Screen 527
Unexpected End of File in Line xxx 527
Parse Error and Unexpected Characters 528
Unexpected T_STRING 528
Unexpected T_ELSE 529
Wrong Equal Sign 529
Failed to Open Stream 529
Syntax Errors 529
Warning: Division by Zero 530
Display Is Not What Was Expected 530
Reference to a Primary Key Could Not Be Created 530
Element < style>
Problem with Prepared Statement 530
Logical Errors 531
The Internet Is Your Friend 531
Summary 531
Appendix B: Resources 533
PHP Quick Reference 533
Arrays 533
Associative Arrays 534
Comments 535
Concatenation 536
Constants 536
E-mailing with PHP 536
Explanation of the Code 538
Functions 538
include() vs. require() 538
if, else, and elseif 538
The Explanation 540
Loops 540
The while Loop 540
The for Loop 541
The foreach Loop 541
The do while Loop 542
Numbers 542
Prepared Statements 543
Sessions 544
Logging In with a Session 544
Logging Out 545
Ternary Operator 546
Using Try/Catch 546
Validation and Sanitization Filters 548
Variables 549
Variables: Predefined 549
Variables: String 549
Bootstrap Template 549
MySQL and phpMyAdmin Quick Reference 550
date_time 551
INSERT 552
SELECT 552
UPDATE 552
Storage Engines and phpMyAdmin 553
Changing the Storage Engine on an Existing Populated Table 553
What Next? 553
Resources 553
Books on PHP and MySQL for Databases 553
PHP and MySQL Internet Resources 554
E-commerce Resources 554
Online Tutorials 555
Resources for Creating a Forum 555
PayPal Forums 555
Third-Party Shopping Carts 555
Summary 555
Index 556

Erscheint lt. Verlag 28.9.2018
Zusatzinfo XX, 546 p. 177 illus.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Datenbanken MySQL
Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Informatik Theorie / Studium Algorithmen
Mathematik / Informatik Informatik Web / Internet
Schlagworte application • build • Code • Database • Data Driven • MariaDB • MySQL • PHP • Practical • Software • Web
ISBN-10 1-4842-3843-5 / 1484238435
ISBN-13 978-1-4842-3843-1 / 9781484238431
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 15,7 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Programmieren lernen in 14 Tagen. Einfach und ohne Vorkenntnisse

von Philipp Rieber

eBook Download (2021)
MITP Verlags GmbH & Co. KG
11,99
Ihr praktischer Einstieg in die Programmierung dynamischer Websites

von Florence Maurice

eBook Download (2019)
dpunkt (Verlag)
22,90